Bug #21898
closedFatal error in cbox-theme
0%
Description
I'm seeing the following in the PHP error logs:
[28-Jan-2025 18:35:41 UTC] PHP Fatal error: Uncaught ICE_Export_Exception: Unable to create the directory: /exports/teleplaza-cbox-theme in /var/www/webroot/ROOT/wp-content/themes/cbox-theme/engine/ICE/utils/export.php:280
I'm thinking that this is related to S3, since the code in question is related to creating directories, which probably works differently when wp_upload_dir() doesn't point locally.
I'm unsure what these dynamically-generated "export" files are used for. If they're needed, the proper fix is probably to ensure that the s3-uploads plugin doesn't filter wp_upload_dir when Infinity sets up its paths. That way, it would simply write to the filesystem in the normal way. This would need to happen both for read and write. See https://github.com/cuny-academic-commons/cac/blob/2.5.x/wp-content/plugins/s3-uploads/inc/class-plugin.php#L106; the unhook process would work something like:
if ( class_exists( '\S3_Uploads\Plugin' ) ) { $s3_uploads = \S3_Uploads\Plugin::get_instance(); remove_action( $s3_uploads, 'filter_upload_dir' ); }
then probably setting a flag and re-hooking it afterward.
But if this code is not necessary, it could probably just be choked off somewhere.
Updated by Raymond Hoh about 1 month ago
The problem with cbox-theme
during its upload directory call is it uses realpath()
, which fails on the Reclaim servers due to S3: https://github.com/cuny-academic-commons/cbox-theme/blob/7d6168fdbe5c2ae27294771013c2f42d9bbbaea6/engine/ICE/utils/export.php#L179. Once I removed the realpath()
call, cbox-theme
is loading again and also works with S3.
The PHP docs says that:
The running script must have executable permissions on all directories in the hierarchy, otherwise realpath() will return false.
That's what is happening here. It looks like the original intention with realpath()
for cbox-theme
was to work better with Windows servers: https://github.com/cuny-academic-commons/cbox-theme/commit/d40660201003a7823656b130673bb40e4a0e9b20#diff-e80a920c1a2c21e589f88ada81bacb6bd36ac39741c441ce2329588c33e550af