Most notably it's not supported on Solaris and Alpine (a quite popular lightweight linux distribution used mostly for running docker containers), so it's throwing a PHP notice
Related ticket: https://secure.helpscout.net/conversation/246673063/21677/?folderId=637040
Potential fix: https://github.com/moderntribe/the-events-calendar/commit/29a24e519eac3fd672e8542a606d81774b2baf94
@GeekPress what do you think about this?
glob cost a lot in ressource. Not sure to implement a double glob will be great. How much time did we have this issue?
First time I think
It seems to be an exotic issue
SunOS could be another one.
https://secure.helpscout.net/conversation/269503186/25314/?folderId=714999
鉂楋笍 @Tabrisrp / @GeekPress FYI: According to a recent reply to the ticket from my previous comment, the error occurs on a regular shared web hosting environment of a major German web host: STRATO.
Update: Customer assumes STRATO uses SunOS only on older servers, but still a show stopper for clients hosted on those.
Another ticket here:
https://secure.helpscout.net/conversation/967731643/124733/
They are on Strato.
Hi,
any progress on this?
we are running on Alpine and also encounter issues with it.
Warning: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE'
plugins/wp-rocket/inc/functions/files.php in rocket_clean_home
```PHP
// Delete homepage.
$files = glob( $root . '/{index,index-*}.{html,html_gzip}', GLOB_BRACE | GLOB_NOSORT );
Warning: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE'
plugins/wp-rocket/inc/functions/files.php in rocket_clean_home at line 719
```PHP
// Remove the hidden empty file for mobile detection on NGINX with the Rocket NGINX configuration.
$nginx_mobile_detect_files = glob( $root . '/.mobile-active', GLOB_BRACE | GLOB_NOSORT );
Thanks
Some problem on Alpine.
There's just one more instance of glob() in Rocket's code base. It's in inc/main.php in the rocket_deactivation function found here.
This is a good first contribution for our newest software dev @iCaspar . Once a PR is merged for this last instance of glob(), we can close this issue.
Turns out, we're still using glob() in several more places:
In files.php Lines
Integration/.../Engine/Cache/PurgeActionsSubscrber) that a workaround was used for vfs incompatibility with glob() one of those uses in files.Related ticket (Alpine) - https://secure.helpscout.net/conversation/1292160882/197454/
Customer used this snippet to fix the issue on their end:
add_action( 'before_rocket_clean_home', 'purge_home_cache_files', 10 );
function purge_home_cache_files( $root ) {
// Original files getter
// $files = glob( $root . '/{index,index-*}.{html,html_gzip}', GLOB_BRACE | GLOB_NOSORT );
$files = glob( $root . '/index-http*' );
$files_mob = glob( $root . '/index-mobile*' );
$files = array_merge( $files, $files_mob );
if ( $files ) {
foreach ( $files as $file ) {
// Delete homepage cache files.
rocket_direct_filesystem()->delete( $file );
}
}
}
Need to address 3 instances of this in rocket_clean_home().
Another case: https://secure.helpscout.net/conversation/1347350243/215402
It seems that this will throw an error in future versions of PHP:
- PHP Warning: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' (this will throw an Error in a future version of PHP) in /mnt/web509/b2/25/510641625/htdocs/WordPress_02/wp-content/plugins/wp-rocket/inc/functions/files.php on line 640
Related ticket: https://secure.helpscout.net/conversation/1355674240/219446/
Assigning this to milestone 3.8.1 -- with PHP8 we need to get this taken care of asap.
There are exactly 3 instances of GLOB_BRACE remaining in files.php:
L: 616, 632, 640
Of those the instances on L:632 and L:640 can be simply removed; there are no braces in the pattern to be evaluated.
On L:616, we can replace the glob with _rocket_get_recursive_dir_files($regex) where $regex replaces the braketed pattern.
Refactoring should be straightforward, but will also need to get rocket_clean_home() under test as part of the PR.
Effort: [S]
@Tabrisrp Is this safe to be included in a minor? Or will it need staggered release? (cc: @GeekPress)
If it's safe to include in a minor, lets at least plan for 3.8.2 since we hope to release 3.8.1 early next week. Iirc, changes to GLOB_BRACE created tickets in the past.
@arunbasillal Yes, this should be fine for a minor. 3.8.2 sounds like a good timeline for it.
@NataliaDrause @jorgemartine00 Thanks for the submissions. FYI, in case you wish to tease the customers, this is planned for 3.8.2. 馃殌
@wp-media/php The linked PR #3436 removes the last of GLOB_BRACE per the OP on this issue. @wp-media/qa has given it an initial review, but further discussion came up about removing glob altogether, as a performance enhancement.
In the interest of getting rid of the actual problem issue, I'm in favor of getting this merged now, and saving the overall use of glob as an enhancement (we have more uses of glob without GLOB_BRACE in the codebase.)
I've opened this issue to continue that discussion in order to unblock this and get it finally into the 3.8.2 release as it directly affects customers.
I agree, we can take it further later as part of our filesystem module.
Related ticket: https://secure.helpscout.net/conversation/1426657994/239695?folderId=2135277
The site is hosted by Strato.
Related ticket - https://secure.helpscout.net/conversation/1445018305/244992/
Most helpful comment
@NataliaDrause @jorgemartine00 Thanks for the submissions. FYI, in case you wish to tease the customers, this is planned for 3.8.2. 馃殌