Woocommerce-admin: Failed to Open Theme Dirs in Case of Symbolic Links

Created on 10 Nov 2020  Â·  4Comments  Â·  Source: woocommerce/woocommerce-admin

Prerequisites (mark completed items with an [x]):

  • [x] I have have carried out troubleshooting steps and I believe I have found a bug.
  • [x] I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

  • ( ! ) Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/var/www/wordpress/wp-content/themes/xxx): failed to open dir: Permission denied in /var/www/wordpress/wp-content/plugins/woocommerce/packages/woocommerce-admin/src/Features/Onboarding.php on line 583
  • exception occurs if /var/www/wordpress/wp-content/themes/xxx is a symbolic link (ln -s /var/www/wordpress/wp-content/themes/xxx /home/user/xxx/)

Expected behavior

  • ignore themes if they are symbolic links or
  • parse symbolic links properly

Actual behavior

  • exception occurs if theme is a symbolic link

Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.)
Steps to reproduce the bug:

  1. Copy a theme to /home/user/xxx/.
  2. Create a symbolic link ln -s /var/www/wordpress/wp-content/themes/xxx /home/user/xxx/.
  3. Open WooCommerce home page in WordPress.
  4. See exception.

Isolating the problem (mark completed items with an [x]):

  • [x] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • [x] This bug happens with a default WordPress theme active, or Storefront.
  • [x] I can reproduce this bug consistently using the steps above.

WordPress Environment

WordPress Environment

WordPress address (URL): https://localhost/shop
Site address (URL): https://localhost/shop
WC Version: 4.6.2
REST API Version: âś” 4.6.2
WC Blocks Version: âś” 3.4.0
Action Scheduler Version: âś” 3.1.6
WC Admin Version: âś” 1.6.2
Log Directory Writable: âś”
WP Version: 5.5.3
WP Multisite: âś”
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: –
Language: de_DE_formal
External object cache: –

Server Environment

Server Info: Apache
PHP Version: 7.3.24-3+ubuntu18.04.1+deb.sury.org+1
PHP Post Max Size: 210 MB
PHP Time Limit: 180
PHP Max Input Vars: 2000
cURL Version: 7.58.0
OpenSSL/1.1.1g

SUHOSIN Installed: –
MySQL Version: 8.0.22
Max Upload Size: 120 MB
Default Timezone is UTC: âś”
fsockopen/cURL: âś”
SoapClient: âś”
DOMDocument: âś”
GZip: âś”
Multibyte String: âś”
Remote Post: âś”
Remote Get: âś”

Database

WC Database Version: 4.6.2
WC Database Prefix: 39_
Datenbank-Gesamtgröße: 5.87MB
Datenbank-Datengröße: 3.77MB
Datenbank-Indexgröße: 2.10MB
39_woocommerce_sessions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_woocommerce_api_keys: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_attribute_taxonomies: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_woocommerce_downloadable_product_permissions: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB
39_woocommerce_order_items: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_woocommerce_order_itemmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_tax_rates: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB
39_woocommerce_tax_rate_locations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_shipping_zones: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_woocommerce_shipping_zone_locations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_shipping_zone_methods: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_woocommerce_payment_tokens: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_woocommerce_payment_tokenmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_log: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_actionscheduler_actions: Daten: 0.02MB + Index: 0.11MB + Engine InnoDB
39_actionscheduler_claims: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_actionscheduler_groups: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_actionscheduler_logs: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_commentmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_comments: Daten: 0.02MB + Index: 0.09MB + Engine InnoDB
39_links: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_options: Daten: 1.05MB + Index: 0.08MB + Engine InnoDB
39_postmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_posts: Daten: 0.05MB + Index: 0.06MB + Engine InnoDB
39_serial_numbers: Daten: 0.02MB + Index: 0.08MB + Engine InnoDB
39_serial_numbers_activations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_term_relationships: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_term_taxonomy: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_termmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_terms: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_wc_admin_note_actions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_wc_admin_notes: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_wc_category_lookup: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_wc_customer_lookup: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_wc_download_log: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_wc_order_coupon_lookup: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_wc_order_product_lookup: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB
39_wc_order_stats: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB
39_wc_order_tax_lookup: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_wc_product_meta_lookup: Daten: 0.02MB + Index: 0.09MB + Engine InnoDB
39_wc_reserved_stock: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_wc_tax_rate_classes: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_wc_webhooks: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_wcpdf_invoice_number: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_woocommerce_gzd_dhl_labelmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_gzd_dhl_labels: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_gzd_shipment_itemmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_gzd_shipment_items: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB
39_woocommerce_gzd_shipmentmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_gzd_shipments: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_woocommerce_gzd_shipping_provider: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB
39_woocommerce_gzd_shipping_providermeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_yoast_indexable: Daten: 0.02MB + Index: 0.08MB + Engine InnoDB
39_yoast_indexable_hierarchy: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB
39_yoast_migrations: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB
39_yoast_primary_term: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
39_yoast_seo_links: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
blogmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB
blogs: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM
registration_log: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM
signups: Daten: 0.01MB + Index: 0.01MB + Engine MyISAM
site: Daten: 0.00MB + Index: 0.01MB + Engine MyISAM
sitemeta: Daten: 1.35MB + Index: 0.02MB + Engine MyISAM
usermeta: Daten: 0.18MB + Index: 0.11MB + Engine MyISAM
users: Daten: 0.01MB + Index: 0.01MB + Engine MyISAM

Post Type Counts

attachment: 2
customize_changeset: 1
nav_menu_item: 8
oembed_cache: 1
page: 12
post: 2
product: 1
revision: 19
shop_order: 1

Security

Secure connection (HTTPS): âś”
Hide errors from visitors: âś”

Active Plugins (13)

WooCommerce PayPal Checkout Gateway: von WooCommerce – 2.1.0 – Die installierte Version wurde nicht mit der aktiven WooCommerce-Version 4.6.2 getestet
Germanized für WooCommerce: von vendidero – 3.2.3
WooCommerce PDF Invoices & Packing Slips: von Ewout Fernhout – 2.7.0
WooCommerce: von Automattic – 4.6.2

Inactive Plugins (38)

Settings

API Enabled: –
Force SSL: –
Currency: EUR (€)
Currency Position: right_space
Thousand Separator: .
Decimal Separator: ,
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to WooCommerce.com: –

WC Pages

Shop-Basis: woocommerce/woocommerce#5 - /shop/
Warenkorb: woocommerce/woocommerce#6 - /warenkorb/
Kasse: woocommerce/woocommerce#7 - /kasse/
Mein Konto: woocommerce/woocommerce#8 - /mein-konto/
Allgemeine Geschäftsbedingungen: woocommerce/woocommerce#446 - /allgemeine-geschaeftsbedingungen-agb/

Theme

Name: Storefront
Version: 2.8.0 (Update auf Version 2.9.0 ist verfĂĽgbar)
Author URL: https://woocommerce.com/
Child Theme: ❌ – Wenn Sie WooCommerce mit einem Theme
das Sie nicht selbst entwickelt haben
an eigene BedĂĽrfnisse anpassen
dann empfehlen wir die Verwendung eines Child-Themes. Siehe Wie Sie ein Child-Theme erstellen (engl.)

WooCommerce Support: âś”

Templates

Overrides: –

Action Scheduler

Abgeschlossen: 31
Oldest: 2020-10-13 11:04:19 +0200
Newest: 2020-10-27 15:01:45 +0100

high

All 4 comments

Hi @raubv0gel,

Thank you for reporting the issue. It looks like it is being caused by WooCommerce Admin which is being developed in another repository: https://github.com/woocommerce/woocommerce-admin.

I am going to move your bug report there so that the right team could take a look further.

Hi @raubv0gel,
​
Thank you for taking the time to report this bug, we really appreciate your help. I can reproduce it on my end.

It looks like RecursiveDirectoryIterator needs to be used with the FOLLOW_SYMLINKS flag.
​
Since it results in a fatal error I have set a high priority to fix this.

@adrianduffell, thank you very much!

Hi @raubv0gel,

It looks like this was fixed in PR #5783 as part of a similar issue. It can be tested in the 1.8 beta released today.

I'm going to close this now but please re-open if the issue persists.

Was this page helpful?
0 / 5 - 0 ratings