Unchecked use of FS_CHMOD_FILE constand (PHP8.1 compatibility?)
-
Hello. Bookly failes in the Booking process after the address input step (more specifically: when generating the .ics attachment) with this error:
`wp-fpm-1 | NOTICE: PHP message: PHP Fatal error: Uncaught Error: Undefined constant “FS_CHMOD_FILE” in /var/www/html/wp-admin/includes/class-wp-filesystem-direct.php:164
wp-fpm-1 | 192.168.96.2 – 10/Jun/2022:08:28:16 +0000 “POST /wp-admin/admin-ajax.php” 500
wp-fpm-1 | Stack trace:
wp-fpm-1 | #0 /var/www/html/wp-admin/includes/class-wp-filesystem-direct.php(86): WP_Filesystem_Direct->chmod(‘/tmp/Bookly_PJe…’, false)
wp-fpm-1 | #1 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/notifications/assets/item/ICS.php(62): WP_Filesystem_Direct->put_contents(‘/tmp/Bookly_PJe…’, ‘BEGIN:VCALENDAR…’)
wp-fpm-1 | #2 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/notifications/assets/item/Attachments.php(33): Bookly\Lib\Notifications\Assets\Item\ICS->create()
wp-fpm-1 | #3 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/notifications/base/Reminder.php(290): Bookly\Lib\Notifications\Assets\Item\Attachments->createFor(Object(Bookly\Lib\Entities\Notification))
wp-fpm-1 | #4 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/notifications/base/Reminder.php(154): Bookly\Lib\Notifications\Base\Reminder::_sendEmailTo(‘client’, ‘[email protected]’, Object(Bookly\Lib\Entities\Notification), Object(Bookly\Lib\Notifications\Assets\Item\Codes), Object(Bookly\Lib\Notifications\Assets\Item\Attachments), NULL, NULL, NULL, Array, false)
wp-fpm-1 | #5 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/notifications/booking/BaseSender.php(41): Bookly\Lib\Notifications\Base\Reminder::sendToClient(Object(Bookly\Lib\Entities\Customer), Object(Bookly\Lib\Entities\Notification), Object(Bookly\Lib\Notifications\Assets\Item\Codes), Object(Bookly\Lib\Notifications\Assets\Item\Attachments), false)
wp-fpm-1 | #6 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/notifications/cart/Sender.php(41): Bookly\Lib\Notifications\Booking\BaseSender::notifyClient(Array, Object(Bookly\Lib\DataHolders\Booking\Simple), Object(Bookly\Lib\DataHolders\Booking\Order), Object(Bookly\Lib\Notifications\Assets\Item\Codes))
wp-fpm-1 | #7 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/frontend/modules/booking/Ajax.php(823): Bookly\Lib\Notifications\Cart\Sender::send(Object(Bookly\Lib\DataHolders\Booking\Order))
wp-fpm-1 | #8 [internal function]: Bookly\Frontend\Modules\Booking\Ajax::saveAppointment()
wp-fpm-1 | #9 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/base/Ajax.php(54): call_user_func(Array)
wp-fpm-1 | #10 /var/www/html/wp-content/plugins/bookly-responsive-appointment-booking-tool/lib/base/Ajax.php(31): Bookly\Lib\Base\Ajax::forward(‘saveAppointment’, true, true)
wp-fpm-1 | #11 /var/www/html/wp-includes/class-wp-hook.php(307): Bookly\Lib\Base\Ajax::Bookly\Lib\Base\{closure}(”)
wp-fpm-1 | #12 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(”, Array)
wp-fpm-1 | #13 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
wp-fpm-1 | #14 /var/www/html/wp-admin/admin-ajax.php(202): do_action(‘wp_ajax_nopriv_…’)
wp-fpm-1 | #15 {main}
wp-fpm-1 | thrown in /var/www/html/wp-admin/includes/class-wp-filesystem-direct.php on line 164′Looks like Bookly is assuming a constant is defined instead of checking. Funny enough, this just happens with PHP8.1, not with 7.x versions.
Here is a good explaination for what I think is happening:
https://wordpress.stackexchange.com/questions/253274/use-of-undefined-constant-fs-chmod-dir-assumed-fs-chmod-dirThanks for looking into this!
Tobias
- The topic ‘Unchecked use of FS_CHMOD_FILE constand (PHP8.1 compatibility?)’ is closed to new replies.