Describe the bug
When going through the on-boarding in WooCommerce Admin, I'm unable to select the Storefront theme because:
This theme does not support WooCommerce
According to @justinshreve the theme support badge is wrong. See
To Reproduce
Steps to reproduce the behavior:
git.git checkout 3.7.0-rc.2.master at the time this issue is opened)WooCommerce menu, and go through initial setup until you have to choose a theme.Expected behavior
I can select and use the Storefront theme.
Screenshots

Desktop (please complete the following information):
Smartphone (please complete the following information):
N/A
Additional context
I only noticed this after updating WooCommerce to 3.7.0-rc.2, but I don鈥檛 know if this occurred after git pull on master in wc-admin, or if it鈥檚 because of the WooCommerce version. Maybe a mix of both?
I'm not seeing this in either Chrome or Firefox with current WC master, WC Admin master & Storefront 2.5.1. @reykjalin Can you re-check?

in either Chrome or Firefox with current WC master
@rrennick WC should be version 3.7.0-rc.2, not master; I haven't tried WC master.
I'm still seeing the issue after:
master.Just posting this as an update, next things I'll be looking into:
master. <-- I think this is the most likely thing to be the cause, but I believe @jeffstieler was unable to reproduce, even using version 3.7.0-rc.2.Is there any information about my specific setup that I can give you that might help here?
I'm using VVV to run my environment, and have several deactivated plugins that could maybe cause an interferance?
@reykjalin The way we detect this is a bit of a hack, and it has to look at the source code of your theme to determine if the theme supports WC or not:
This must be failing somehow.
Could you enable WP_DEBUG, and perhaps add some error_log calls to that function? Specifically wondering about things like $content and $files.
@justinshreve it seems that function isn't being called? I don't see anything appear when adding error_log statements, and when I use XDebug and add breakpoints to the function it doesn't stop there.
I'd like to see if this could be the problem before I change/update anything on my end. Any way you can confirm that this function should be called, and where it could possibly be going off course? I can't find any explicit call to this function in the code?
The only thing I see is an entirely separate error that isn't related. When I fix the error from debug.log (proposed fix below) I still can't use Storefront.
[08-Aug-2019 14:59:15 UTC] PHP Notice: Undefined variable: slug in /srv/www/wordpress-one/public_html/wp-content/plugins/woocommerce-admin/includes/api/class-wc-admin-rest-onboarding-plugins-controller.php on line 259
[08-Aug-2019 14:59:16 UTC] PHP Stack trace:
[08-Aug-2019 14:59:16 UTC] PHP 1. {main}() /srv/www/wordpress-one/public_html/index.php:0
[08-Aug-2019 14:59:16 UTC] PHP 2. require() /srv/www/wordpress-one/public_html/index.php:17
[08-Aug-2019 14:59:16 UTC] PHP 3. wp($query_vars = *uninitialized*) /srv/www/wordpress-one/public_html/wp-blog-header.php:16
[08-Aug-2019 14:59:16 UTC] PHP 4. WP->main($query_args = '') /srv/www/wordpress-one/public_html/wp-includes/functions.php:1105
[08-Aug-2019 14:59:16 UTC] PHP 5. WP->parse_request($extra_query_vars = '') /srv/www/wordpress-one/public_html/wp-includes/class-wp.php:737
[08-Aug-2019 14:59:16 UTC] PHP 6. do_action_ref_array($tag = 'parse_request', $args = array (0 => class WP { public $public_query_vars = array (0 => 'm', 1 => 'p', 2 => 'posts', 3 => 'w', 4 => 'cat', 5 => 'withcomments', 6 => 'withoutcomments', 7 => 's', 8 => 'search', 9 => 'exact', 10 => 'sentence', 11 => 'calendar', 12 => 'page', 13 => 'paged', 14 => 'more', 15 => 'tb', 16 => 'pb', 17 => 'author', 18 => 'order', 19 => 'orderby', 20 => 'year', 21 => 'monthnum', 22 => 'day', 23 => 'hour', 24 => 'minute', 25 => 'second', 26 => 'name', 27 => 'category_name', 28 => 'tag', 29 => 'feed', 30 => 'author_name', 31 => 'static', 32 => 'pagename', 33 => 'page_id', 34 => 'error', 35 => 'attachment', 36 => 'attachment_id', 37 => 'subpost', 38 => 'subpost_id', 39 => 'preview', 40 => 'robots', 41 => 'taxonomy', 42 => 'term', 43 => 'cpage', 44 => 'post_type', 45 => 'embed', 46 => 'post_format', 47 => 'wc-api', 48 => 'product_cat', 49 => 'product_tag', 50 => 'product', 51 => 'rest_route', 52 => 'order-pay', 53 => 'order-received', 54 => 'orders', 55 => 'view-order', 56 => 'downloads', 57 => 'edit-account', 58 => 'edit-address', 59 => 'payment-methods', 60 => 'lost-password', 61 => 'customer-logout', 62 => 'add-payment-method', 63 => 'delete-payment-method', 64 => 'set-default-payment-method', 65 => 'wc-auth-version', 66 => 'wc-auth-route', 67 => 'order-pay', 68 => 'order-received', 69 => 'orders', 70 => 'view-order', 71 => 'downloads', 72 => 'edit-account', 73 => 'edit-address', 74 => 'payment-methods', 75 => 'lost-password', 76 => 'customer-logout', 77 => 'add-payment-method', 78 => 'delete-payment-method', 79 => 'set-default-payment-method', 80 => 'wc-api-version', 81 => 'wc-api-route', 82 => 'wc-api'); public $private_query_vars = array (0 => 'offset', 1 => 'posts_per_page', 2 => 'posts_per_archive_page', 3 => 'showposts', 4 => 'nopaging', 5 => 'post_type', 6 => 'post_status', 7 => 'category__in', 8 => 'category__not_in', 9 => 'category__and', 10 => 'tag__in', 11 => 'tag__not_in', 12 => 'tag__and', 13 => 'tag_slug__in', 14 => 'tag_slug__and', 15 => 'tag_id', 16 => 'post_mime_type', 17 => 'perm', 18 => 'comments_per_page', 19 => 'post__in', 20 => 'post__not_in', 21 => 'post_parent', 22 => 'post_parent__in', 23 => 'post_parent__not_in', 24 => 'title', 25 => 'fields'); public $extra_query_vars = array (); public $query_vars = array ('rest_route' => '/wc-admin/v1/onboarding/plugins/connect-jetpack'); public $query_string = NULL; public $request = NULL; public $matched_rule = NULL; public $matched_query = NULL; public $did_permalink = FALSE })) /srv/www/wordpress-one/public_html/wp-includes/class-wp.php:387
[08-Aug-2019 14:59:16 UTC] PHP 7. WP_Hook->do_action($args = array (0 => class WP { public $public_query_vars = array (0 => 'm', 1 => 'p', 2 => 'posts', 3 => 'w', 4 => 'cat', 5 => 'withcomments', 6 => 'withoutcomments', 7 => 's', 8 => 'search', 9 => 'exact', 10 => 'sentence', 11 => 'calendar', 12 => 'page', 13 => 'paged', 14 => 'more', 15 => 'tb', 16 => 'pb', 17 => 'author', 18 => 'order', 19 => 'orderby', 20 => 'year', 21 => 'monthnum', 22 => 'day', 23 => 'hour', 24 => 'minute', 25 => 'second', 26 => 'name', 27 => 'category_name', 28 => 'tag', 29 => 'feed', 30 => 'author_name', 31 => 'static', 32 => 'pagename', 33 => 'page_id', 34 => 'error', 35 => 'attachment', 36 => 'attachment_id', 37 => 'subpost', 38 => 'subpost_id', 39 => 'preview', 40 => 'robots', 41 => 'taxonomy', 42 => 'term', 43 => 'cpage', 44 => 'post_type', 45 => 'embed', 46 => 'post_format', 47 => 'wc-api', 48 => 'product_cat', 49 => 'product_tag', 50 => 'product', 51 => 'rest_route', 52 => 'order-pay', 53 => 'order-received', 54 => 'orders', 55 => 'view-order', 56 => 'downloads', 57 => 'edit-account', 58 => 'edit-address', 59 => 'payment-methods', 60 => 'lost-password', 61 => 'customer-logout', 62 => 'add-payment-method', 63 => 'delete-payment-method', 64 => 'set-default-payment-method', 65 => 'wc-auth-version', 66 => 'wc-auth-route', 67 => 'order-pay', 68 => 'order-received', 69 => 'orders', 70 => 'view-order', 71 => 'downloads', 72 => 'edit-account', 73 => 'edit-address', 74 => 'payment-methods', 75 => 'lost-password', 76 => 'customer-logout', 77 => 'add-payment-method', 78 => 'delete-payment-method', 79 => 'set-default-payment-method', 80 => 'wc-api-version', 81 => 'wc-api-route', 82 => 'wc-api'); public $private_query_vars = array (0 => 'offset', 1 => 'posts_per_page', 2 => 'posts_per_archive_page', 3 => 'showposts', 4 => 'nopaging', 5 => 'post_type', 6 => 'post_status', 7 => 'category__in', 8 => 'category__not_in', 9 => 'category__and', 10 => 'tag__in', 11 => 'tag__not_in', 12 => 'tag__and', 13 => 'tag_slug__in', 14 => 'tag_slug__and', 15 => 'tag_id', 16 => 'post_mime_type', 17 => 'perm', 18 => 'comments_per_page', 19 => 'post__in', 20 => 'post__not_in', 21 => 'post_parent', 22 => 'post_parent__in', 23 => 'post_parent__not_in', 24 => 'title', 25 => 'fields'); public $extra_query_vars = array (); public $query_vars = array ('rest_route' => '/wc-admin/v1/onboarding/plugins/connect-jetpack'); public $query_string = NULL; public $request = NULL; public $matched_rule = NULL; public $matched_query = NULL; public $did_permalink = FALSE })) /srv/www/wordpress-one/public_html/wp-includes/plugin.php:531
[08-Aug-2019 14:59:16 UTC] PHP 8. WP_Hook->apply_filters($value = '', $args = array (0 => class WP { public $public_query_vars = array (0 => 'm', 1 => 'p', 2 => 'posts', 3 => 'w', 4 => 'cat', 5 => 'withcomments', 6 => 'withoutcomments', 7 => 's', 8 => 'search', 9 => 'exact', 10 => 'sentence', 11 => 'calendar', 12 => 'page', 13 => 'paged', 14 => 'more', 15 => 'tb', 16 => 'pb', 17 => 'author', 18 => 'order', 19 => 'orderby', 20 => 'year', 21 => 'monthnum', 22 => 'day', 23 => 'hour', 24 => 'minute', 25 => 'second', 26 => 'name', 27 => 'category_name', 28 => 'tag', 29 => 'feed', 30 => 'author_name', 31 => 'static', 32 => 'pagename', 33 => 'page_id', 34 => 'error', 35 => 'attachment', 36 => 'attachment_id', 37 => 'subpost', 38 => 'subpost_id', 39 => 'preview', 40 => 'robots', 41 => 'taxonomy', 42 => 'term', 43 => 'cpage', 44 => 'post_type', 45 => 'embed', 46 => 'post_format', 47 => 'wc-api', 48 => 'product_cat', 49 => 'product_tag', 50 => 'product', 51 => 'rest_route', 52 => 'order-pay', 53 => 'order-received', 54 => 'orders', 55 => 'view-order', 56 => 'downloads', 57 => 'edit-account', 58 => 'edit-address', 59 => 'payment-methods', 60 => 'lost-password', 61 => 'customer-logout', 62 => 'add-payment-method', 63 => 'delete-payment-method', 64 => 'set-default-payment-method', 65 => 'wc-auth-version', 66 => 'wc-auth-route', 67 => 'order-pay', 68 => 'order-received', 69 => 'orders', 70 => 'view-order', 71 => 'downloads', 72 => 'edit-account', 73 => 'edit-address', 74 => 'payment-methods', 75 => 'lost-password', 76 => 'customer-logout', 77 => 'add-payment-method', 78 => 'delete-payment-method', 79 => 'set-default-payment-method', 80 => 'wc-api-version', 81 => 'wc-api-route', 82 => 'wc-api'); public $private_query_vars = array (0 => 'offset', 1 => 'posts_per_page', 2 => 'posts_per_archive_page', 3 => 'showposts', 4 => 'nopaging', 5 => 'post_type', 6 => 'post_status', 7 => 'category__in', 8 => 'category__not_in', 9 => 'category__and', 10 => 'tag__in', 11 => 'tag__not_in', 12 => 'tag__and', 13 => 'tag_slug__in', 14 => 'tag_slug__and', 15 => 'tag_id', 16 => 'post_mime_type', 17 => 'perm', 18 => 'comments_per_page', 19 => 'post__in', 20 => 'post__not_in', 21 => 'post_parent', 22 => 'post_parent__in', 23 => 'post_parent__not_in', 24 => 'title', 25 => 'fields'); public $extra_query_vars = array (); public $query_vars = array ('rest_route' => '/wc-admin/v1/onboarding/plugins/connect-jetpack'); public $query_string = NULL; public $request = NULL; public $matched_rule = NULL; public $matched_query = NULL; public $did_permalink = FALSE })) /srv/www/wordpress-one/public_html/wp-includes/class-wp-hook.php:310
[08-Aug-2019 14:59:16 UTC] PHP 9. rest_api_loaded(class WP { public $public_query_vars = array (0 => 'm', 1 => 'p', 2 => 'posts', 3 => 'w', 4 => 'cat', 5 => 'withcomments', 6 => 'withoutcomments', 7 => 's', 8 => 'search', 9 => 'exact', 10 => 'sentence', 11 => 'calendar', 12 => 'page', 13 => 'paged', 14 => 'more', 15 => 'tb', 16 => 'pb', 17 => 'author', 18 => 'order', 19 => 'orderby', 20 => 'year', 21 => 'monthnum', 22 => 'day', 23 => 'hour', 24 => 'minute', 25 => 'second', 26 => 'name', 27 => 'category_name', 28 => 'tag', 29 => 'feed', 30 => 'author_name', 31 => 'static', 32 => 'pagename', 33 => 'page_id', 34 => 'error', 35 => 'attachment', 36 => 'attachment_id', 37 => 'subpost', 38 => 'subpost_id', 39 => 'preview', 40 => 'robots', 41 => 'taxonomy', 42 => 'term', 43 => 'cpage', 44 => 'post_type', 45 => 'embed', 46 => 'post_format', 47 => 'wc-api', 48 => 'product_cat', 49 => 'product_tag', 50 => 'product', 51 => 'rest_route', 52 => 'order-pay', 53 => 'order-received', 54 => 'orders', 55 => 'view-order', 56 => 'downloads', 57 => 'edit-account', 58 => 'edit-address', 59 => 'payment-methods', 60 => 'lost-password', 61 => 'customer-logout', 62 => 'add-payment-method', 63 => 'delete-payment-method', 64 => 'set-default-payment-method', 65 => 'wc-auth-version', 66 => 'wc-auth-route', 67 => 'order-pay', 68 => 'order-received', 69 => 'orders', 70 => 'view-order', 71 => 'downloads', 72 => 'edit-account', 73 => 'edit-address', 74 => 'payment-methods', 75 => 'lost-password', 76 => 'customer-logout', 77 => 'add-payment-method', 78 => 'delete-payment-method', 79 => 'set-default-payment-method', 80 => 'wc-api-version', 81 => 'wc-api-route', 82 => 'wc-api'); public $private_query_vars = array (0 => 'offset', 1 => 'posts_per_page', 2 => 'posts_per_archive_page', 3 => 'showposts', 4 => 'nopaging', 5 => 'post_type', 6 => 'post_status', 7 => 'category__in', 8 => 'category__not_in', 9 => 'category__and', 10 => 'tag__in', 11 => 'tag__not_in', 12 => 'tag__and', 13 => 'tag_slug__in', 14 => 'tag_slug__and', 15 => 'tag_id', 16 => 'post_mime_type', 17 => 'perm', 18 => 'comments_per_page', 19 => 'post__in', 20 => 'post__not_in', 21 => 'post_parent', 22 => 'post_parent__in', 23 => 'post_parent__not_in', 24 => 'title', 25 => 'fields'); public $extra_query_vars = array (); public $query_vars = array ('rest_route' => '/wc-admin/v1/onboarding/plugins/connect-jetpack'); public $query_string = NULL; public $request = NULL; public $matched_rule = NULL; public $matched_query = NULL; public $did_permalink = FALSE }) /srv/www/wordpress-one/public_html/wp-includes/class-wp-hook.php:286
[08-Aug-2019 14:59:16 UTC] PHP 10. WP_REST_Server->serve_request($path = '/wc-admin/v1/onboarding/plugins/connect-jetpack') /srv/www/wordpress-one/public_html/wp-includes/rest-api.php:309
[08-Aug-2019 14:59:16 UTC] PHP 11. WP_REST_Server->dispatch($request = class WP_REST_Request { protected $method = 'GET'; protected $params = array ('URL' => array (), 'GET' => array ('rest_route' => '/wc-admin/v1/onboarding/plugins/connect-jetpack', '_locale' => 'user'), 'POST' => array (), 'FILES' => array (), 'JSON' => NULL, 'defaults' => array ()); protected $headers = array ('cookie' => array (0 => 'wp-settings-time-1=1565276339; __stripe_mid=27cc2690-bb9b-45dd-8e39-3e40b369cd3c; wordpress_logged_in_3552b4b59977f536cc96f5dc95f05be2=admin%7C1593524113%7CauW7eSzJQu3ndTfY47fPcJ07nhlNznm6qWFu2OFwP6f%7Cfb5ebcc192e498594437b39ae00ba3b76270c030b484b18158075bf87a3ae496; XDEBUG_SESSION=XDEBUG_ECLIPSE; tk_ai=woo%3Aj6xDNjyWUTK7Udqx0a4RN%2FUG; woocommerce_items_in_cart=1; woocommerce_cart_hash=73de831d18204186abca667f711f2867; wp_woocommerce_session_3552b4b59977f536cc96f5dc95f05be2=1%7C%7C1565379893%7C%7C1565376293%7C%7C5dbbfa4c13d5223704bfb3634642352b'), 'connection' => array (0 => 'keep-alive'), 'dnt' => array (0 => '1'), 'x_wp_nonce' => array (0 => '2e554c8a98'), 'referer' => array (0 => 'http://kreykjalin.ngrok.io/wp-admin/admin.php?page=wc-admin&step=plugins'), 'accept_encoding' => array (0 => 'gzip, deflate'), 'accept_language' => array (0 => 'en-US,en;q=0.5'), 'accept' => array (0 => 'application/json, */*;q=0.1'), 'user_agent' => array (0 => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0'), 'host' => array (0 => 'kreykjalin.ngrok.io'), 'content_length' => array (0 => ''), 'content_type' => array (0 => '')); protected $body = ''; protected $route = '/wc-admin/v1/onboarding/plugins/connect-jetpack'; protected $attributes = array ('methods' => array ('GET' => TRUE), 'accept_json' => FALSE, 'accept_raw' => FALSE, 'show_in_index' => TRUE, 'args' => array (), 'callback' => array (0 => class WC_Admin_REST_Onboarding_Plugins_Controller { protected $namespace = 'wc-admin/v1'; protected $rest_base = 'onboarding/plugins' }, 1 => 'connect_jetpack'), 'permission_callback' => array (0 => class WC_Admin_REST_Onboarding_Plugins_Controller { protected $namespace = 'wc-admin/v1'; protected $rest_base = 'onboarding/plugins' }, 1 => 'update_item_permissions_check')); protected $parsed_json = TRUE; protected $parsed_body = FALSE }) /srv/www/wordpress-one/public_html/wp-includes/rest-api/class-wp-rest-server.php:329
[08-Aug-2019 14:59:16 UTC] PHP 12. WC_Admin_REST_Onboarding_Plugins_Controller->connect_jetpack(class WP_REST_Request { protected $method = 'GET'; protected $params = array ('URL' => array (), 'GET' => array ('rest_route' => '/wc-admin/v1/onboarding/plugins/connect-jetpack', '_locale' => 'user'), 'POST' => array (), 'FILES' => array (), 'JSON' => NULL, 'defaults' => array ()); protected $headers = array ('cookie' => array (0 => 'wp-settings-time-1=1565276339; __stripe_mid=27cc2690-bb9b-45dd-8e39-3e40b369cd3c; wordpress_logged_in_3552b4b59977f536cc96f5dc95f05be2=admin%7C1593524113%7CauW7eSzJQu3ndTfY47fPcJ07nhlNznm6qWFu2OFwP6f%7Cfb5ebcc192e498594437b39ae00ba3b76270c030b484b18158075bf87a3ae496; XDEBUG_SESSION=XDEBUG_ECLIPSE; tk_ai=woo%3Aj6xDNjyWUTK7Udqx0a4RN%2FUG; woocommerce_items_in_cart=1; woocommerce_cart_hash=73de831d18204186abca667f711f2867; wp_woocommerce_session_3552b4b59977f536cc96f5dc95f05be2=1%7C%7C1565379893%7C%7C1565376293%7C%7C5dbbfa4c13d5223704bfb3634642352b'), 'connection' => array (0 => 'keep-alive'), 'dnt' => array (0 => '1'), 'x_wp_nonce' => array (0 => '2e554c8a98'), 'referer' => array (0 => 'http://kreykjalin.ngrok.io/wp-admin/admin.php?page=wc-admin&step=plugins'), 'accept_encoding' => array (0 => 'gzip, deflate'), 'accept_language' => array (0 => 'en-US,en;q=0.5'), 'accept' => array (0 => 'application/json, */*;q=0.1'), 'user_agent' => array (0 => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0'), 'host' => array (0 => 'kreykjalin.ngrok.io'), 'content_length' => array (0 => ''), 'content_type' => array (0 => '')); protected $body = ''; protected $route = '/wc-admin/v1/onboarding/plugins/connect-jetpack'; protected $attributes = array ('methods' => array ('GET' => TRUE), 'accept_json' => FALSE, 'accept_raw' => FALSE, 'show_in_index' => TRUE, 'args' => array (), 'callback' => array (0 => class WC_Admin_REST_Onboarding_Plugins_Controller { protected $namespace = 'wc-admin/v1'; protected $rest_base = 'onboarding/plugins' }, 1 => 'connect_jetpack'), 'permission_callback' => array (0 => class WC_Admin_REST_Onboarding_Plugins_Controller { protected $namespace = 'wc-admin/v1'; protected $rest_base = 'onboarding/plugins' }, 1 => 'update_item_permissions_check')); protected $parsed_json = TRUE; protected $parsed_body = FALSE }) /srv/www/wordpress-one/public_html/wp-includes/rest-api/class-wp-rest-server.php:946
It seems that $slug isn't defined, supposed to be $next_step_slug?
It's called a few lines above:
However, I just remembered we heavily cache the theme data 馃う鈥嶁檪. I'm sorry about that. So it wouldn't be called until the cache expires.
You can temporarily replace the following line
with
$themes = false;
so the cache is not used.
--
I'll fix the unrelated $slug issue. Thanks for logging that as well!
$files seems to be an empty iterator, and thus $content is never reached 馃
[08-Aug-2019 19:07:02 UTC] $files:
[08-Aug-2019 19:07:02 UTC] RegexIterator Object
(
[replacement] =>
)
[08-Aug-2019 19:07:27 UTC] $files:
[08-Aug-2019 19:07:27 UTC] RegexIterator Object
(
[replacement] =>
)
[08-Aug-2019 19:07:31 UTC] $files:
[08-Aug-2019 19:07:31 UTC] RegexIterator Object
(
[replacement] =>
)
[08-Aug-2019 19:07:31 UTC] $files:
[08-Aug-2019 19:07:31 UTC] RegexIterator Object
(
[replacement] =>
)
$themes seems to be correctly passed to the function, although it always only contains one theme. Not sure if that's the intended functionality.
It looks to me like the $files iterator is somehow not properly initialized. I think that's because the $iterator doesn't get the intended value:
[08-Aug-2019 19:16:33 UTC] $directory:
[08-Aug-2019 19:16:33 UTC] RecursiveDirectoryIterator Object
(
[pathName:SplFileInfo:private] => /srv/www/wordpress-one/public_html/wp-content/themes/storefront/.
[fileName:SplFileInfo:private] => .
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
[08-Aug-2019 19:16:33 UTC] $iterator:
[08-Aug-2019 19:16:33 UTC] RecursiveIteratorIterator Object
(
)
[08-Aug-2019 19:16:33 UTC] $directory:
[08-Aug-2019 19:16:33 UTC] RecursiveDirectoryIterator Object
(
[pathName:SplFileInfo:private] => /srv/www/wordpress-one/public_html/wp-content/themes/twentynineteen/.
[fileName:SplFileInfo:private] => .
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
[08-Aug-2019 19:16:33 UTC] $iterator:
[08-Aug-2019 19:16:33 UTC] RecursiveIteratorIterator Object
(
)
[08-Aug-2019 19:16:33 UTC] $directory:
[08-Aug-2019 19:16:33 UTC] RecursiveDirectoryIterator Object
(
[pathName:SplFileInfo:private] => /srv/www/wordpress-one/public_html/wp-content/themes/twentyseventeen/.
[fileName:SplFileInfo:private] => .
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
[08-Aug-2019 19:16:33 UTC] $iterator:
[08-Aug-2019 19:16:33 UTC] RecursiveIteratorIterator Object
(
)
[08-Aug-2019 19:16:33 UTC] $directory:
[08-Aug-2019 19:16:33 UTC] RecursiveDirectoryIterator Object
(
[pathName:SplFileInfo:private] => /srv/www/wordpress-one/public_html/wp-content/themes/twentysixteen/.
[fileName:SplFileInfo:private] => .
[glob:DirectoryIterator:private] =>
[subPathName:RecursiveDirectoryIterator:private] =>
)
[08-Aug-2019 19:16:33 UTC] $iterator:
[08-Aug-2019 19:16:33 UTC] RecursiveIteratorIterator Object
(
)
Maybe this is a permissions issue on my end? It seems like the RecursiveDirectoryIterator works, but maybe can't read the files?
It looks to me like the $files iterator is somehow not properly initialized. I think that's because the $iterator doesn't get the intended value:
@reykjalin These are class instances so if you're dumping them, you won't see an array of files like you might expect. If you log the content of the $file inside the foreach loop, however, you should see the file path.
foreach ( $files as $file ) {
error_log( $file[0] );
}
Maybe this is a permissions issue on my end? It seems like the RecursiveDirectoryIterator works, but maybe can't read the files?
This seems like the most likely case if no other errors are being thrown. Can you confirm permissions for your WP content and theme directories?
Also, which version of PHP are you using?
@joshuatf I'm not just dumping them; looking at them through XDebug and using error_log( print_r( $directory ) ); // same for $iterator.
The foreach loop is actually never entered. Confirmed this through both use of XDebug, as well as error_log() statements.
Permissons on wp-content: drwxr-xr-x directory owner is my user account (as is everything else).
Permissions on themes: drwxr-xr-x directory owner is my user account.
Using PHP v7.2.19-1:

Running my setup using VVV version 3.0.0.
Slight update:
Spun up a fresh VVV environment to make sure I could reproduce; same thing happens. Following the instructions I initially posted got me the same result.
@joshuatf I'm not just dumping them; looking at them through XDebug and using error_log( print_r( $directory ) ); // same for $iterator.
@reykjalin Right- whether you dump/print/log these variables, an empty iterator is expected even if files are found. They have to be run inside a foreach loop to see matches.
Can you post the value you're receiving for $theme->theme_root . '/' . $theme->stylesheet? Can you also try dumping the information of $directory inside a loop to see if this is matching anything? You can do the same with $iterator so we can narrow down the possibilities here.
foreach( $directory as $dir) {
error_log( print_r( $dir ) );
}
This should hopefully print results like the following:

Permissons on wp-content: drwxr-xr-x directory owner is my user account (as is everything else).
Permissions on themes: drwxr-xr-x directory owner is my user account.
This seems correct, but just to double check so we can cross this off:
So, I made a bit of a mistake in reporting the permissions, but they look right anyway:
Directories are owned by
vagrantwww-data.Permissions for wp-content: drwxrwxr-x.
Permissions for themes: drwxrwxr-x.
What's your apache (or other web server) user/group?
nginx user/group is www-data:

They have to be run inside a foreach loop to see matches.
Ah ok, got it!
Can you post the value you're receiving for
$theme->theme_root . '/' . $theme->stylesheet?
/srv/www/wc-admin-test/public_html/wp-content/themes/<theme_directory>
Can you also try dumping the information of $directory inside a loop to see if this is matching anything? You can do the same with $iterator so we can narrow down the possibilities here.
I get 1, which looks weird. See full log below.
You can upload themes from your dashboard without any issue, right?
Yes.
Full log information:
Logging using the following code (starting from line 236 in includes/features/onboarding/class-wc-admin-onboarding):
$directory = new RecursiveDirectoryIterator( $theme->theme_root . '/' . $theme->stylesheet );
$iterator = new RecursiveIteratorIterator( $directory );
$files = new RegexIterator( $iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH );
error_log( 'directory value: ' . $theme->theme_root . '/' . $theme->stylesheet );
error_log( '$directory:' );
foreach( $directory as $dir ) {
error_log( print_r( $dir ) );
}
error_log( '$iterator:' );
foreach( $iterator as $it ) {
error_log( print_r( $it ) );
}
// ...
Gives me the following log:
[27-Aug-2019 07:09:53 UTC] directory value: /srv/www/wc-admin-test/public_html/wp-content/themes/storefront
[27-Aug-2019 07:09:53 UTC] $directory:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] $iterator:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] directory value: /srv/www/wc-admin-test/public_html/wp-content/themes/twentynineteen
[27-Aug-2019 07:09:53 UTC] $directory:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] $iterator:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] directory value: /srv/www/wc-admin-test/public_html/wp-content/themes/twentyseventeen
[27-Aug-2019 07:09:53 UTC] $directory:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] $iterator:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] directory value: /srv/www/wc-admin-test/public_html/wp-content/themes/twentysixteen
[27-Aug-2019 07:09:53 UTC] $directory:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] $iterator:
[27-Aug-2019 07:09:53 UTC] 1
[27-Aug-2019 07:09:53 UTC] 1
cc @joshuatf
@reykjalin Sorry, I gave you the wrong line above; print_r's second argument needs to be true if logging to the error log:
error_log( print_r( $dir, true ) );
It looks like something may be wrong on the directly level, however, since more than 2 iterations should be returned for each of those themes. Maybe looking at the returned value of those iterations will give us a clue as to what's going on.

Does cd /srv/www/wc-admin-test/public_html/wp-content/themes/storefront in a console bring you to the correct location?
Does
cd /srv/www/wc-admin-test/public_html/wp-content/themes/storefrontin a console bring you to the correct location?
Yep, works as intended.
Using the right log command the listed directories are just . and ... From what I can tell this doesn't seem to be a permissions issue since that _should_ throw an exception (I think).
My top theory right now is that the folder sync in vagrant is to blame for this, since it's reportedly a bit wonky sometimes [#].
That should still just mean it would take a bit for the files to sync properly, and not make it so PHP can't find the files 馃し鈥嶁檪.
I've tried changing the user and group of nginx and php-fpm, but still just see . and ...
When I tried to reproduce the error using a different environment (Local by Flywheel) I was unable to reproduce the issue, and everything seems to be working fine there.
Since Local is working I'll just switch to using that and report back if I ever see a similar issue there.
Thanks for taking the time to help me look into this!
Thanks so much for taking the time before to help us debug this @reykjalin!
This looks to be an isolated incident with the environment, so I'll close this issue for now, but if you experience this again feel free to re-open. 馃槃