[wp-trac] [WordPress Trac] #57884: [TinyMCE] class-wp-editor.php is emitting open_basedir restriction warning when using my own error handler
WordPress Trac
noreply at wordpress.org
Wed Mar 8 10:42:03 UTC 2023
#57884: [TinyMCE] class-wp-editor.php is emitting open_basedir restriction warning
when using my own error handler
--------------------------+-----------------------------
Reporter: arnolp | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
My server has open basedir restrictions.
When editing a post on classical editor, on line 530, class-wp-editor
checks for translations loaded for external TinyMCE 3.x plugins.
{{{
if ( @is_file( $path . 'en_dlg.js' ) ) { ..
}}}
On standard case , "@"supress the errors as it should.
But I have, as many users, my own error handling for pushing error logs
in external collector.
So "supress errors" @ seems to be non-effective;
and my logs are full of these :
"is_file(): open_basedir restriction in effect. File(/en_dlg.js) is not
within the allowed path(s): (..) /wp/wp-includes/class-wp-
editor.php","error_line":530
The correct way to check a potential outside of openbasedir restriction
seems to be
{{{
// Default error handler is required
set_error_handler(null);
// Clean last error info. You can do it using error_clean_last in PHP
7.
@trigger_error('__clean_error_info');
// Testing...
@file_exists($path);
// Restore previous error handler
restore_error_handler();
}}}
as to why '$path' seems to be '/' ,thus checking file at server root, I
have no clue ..
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57884>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list