Support » Plugin: WP Debugging » Uncaught Error: Path cannot be empty
Uncaught Error: Path cannot be empty
-
Hello,
when enabling the plugin and opening the file, I got this error:
Fatal error: Uncaught Error: Path cannot be empty in /<path to wordpress>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/helpers.php on line 148
Do I miss a setting ?
Thanks for any help!
-
There is no setting. Deactivate and reactivate. Let me know if the error persists as I’ve not seen it before.
Hello,
reactivated did the trick at first but then it came up again – and I can reproduce it.
Here my steps:- activate plugin
- getting the notice in the top bar (quick debug look menu) that variable is not there
- activated debugging via tools -> wp debugging -> WP_DEBUG true
- did some stuff
- looked at the file via quick debug look -> all fine
- deactivated debugging via tools -> wp debugging -> WP_DEBUG false
- back to the file -> getting the exception. I would have expected that I would be able to look at the file even with debugging deactivated. Since usually you turn on debugging on a live system only for a short time and then turning it off to view at the file without clogging it with new messages.
Some strange thing happened also: I deactivated WP_DEBUG but on my website, PHP errors were still shown (all options of the plugin were unchecked). I had to deactivate the whole plugin to get rid of the error messages on the blog itself.
The Debug Quick Look menu is part of WP Debugging. If the plugin is not active it won’t be there.
Can you share a complete stacktrace of the error?
Is your server able to create a
debug.log
file? That is the file that is “missing”. It should be created. If you selected ‘Purge File’ from the menu.The Debug Quick Look menu is part of WP Debugging. If the plugin is not active it won’t be there.
Yes, that I know. That is not the problem. But maybe I misworded it, since english is not my native tongue. When deactivating the WP_DEBUG constant via your plugin, I still get debugging messages on my blog. The constants WP_DEBUG is deleted from wp_config.php but it still seems to do the output. And there is no other definition of WP_DEBUG anywhere, I double checked. When I deactivate your plugin completely, the messages are gone.
Can you share a complete stacktrace of the error?
I assume you mean the path error ? Sure:
Fatal error: Uncaught ValueError: Path cannot be empty in /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/helpers.php:148 Stack trace: #0 /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/helpers.php(148): file_put_contents('', '') #1 /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/parser.php(37): DebugQuickLook\Helpers\check_debug_file() #2 /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/actions.php(59): DebugQuickLook\Parser\run_parse() #3 /<path to wp>/wp-includes/class-wp-hook.php(308): DebugQuickLook\Actions\run_quicklook_action('') #4 /<path to wp>/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(true, Array) #5 /<path to wp>/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /<path to wp>/wp-admin/admin.php(175): do_action('admin_init') #7 /<path to wp>/wp-admin/index.php(10): require_once('/is/htdocs/wp12...') #8 {main} thrown in /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/helpers.php on line 148 Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/handler.php:253 Stack trace: #0 /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/handler.php(130): DebugQuickLook\Handler\load_handler_message(Object(WP_Error)) #1 /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/handler.php(40): DebugQuickLook\Handler\handler_body_tag(Object(WP_Error), Array) #2 /<path to wp>/wp-includes/functions.php(3722): DebugQuickLook\Handler\build_handler(Object(WP_Error), '', Array) #3 /<path to wp>/wp-includes/class-wp-fatal-error-handler.php(239): wp_die(Object(WP_Error), '', Array) #4 /<path to wp>/wp-includes/class-wp-fatal-error-handler.php(154): WP_Fatal_Error_Handler->display_default_error_template(Array, true) #5 /<path to wp>/wp-includes/class-wp-fatal-error-handler.php(58): WP_Fatal_Error_Handler->display_error_template(Array, true) #6 [internal function]: WP_Fatal_Error_Handler->handle() #7 {main} thrown in /<path to wp>/wp-content/plugins/wp-debugging/vendor/norcross/debug-quick-look/includes/handler.php on line 253
Is your server able to create a
debug.log
file? That is the file that is “missing”. It should be created. If you selected ‘Purge File’ from the menu.It’s created and filled when WP_DEBUG is true, it’s still there when WP_DEBUG is deactivated. But then I get that error above.
I hope this helps.Let me know what else I can do to give you as much information as possible.
-
This reply was modified 8 months ago by
dragon013.
I’ve update the Debug Quick Look code in the
develop
branch. Can you test to see if it fixed your issue?https://github.com/afragen/wp-debugging/archive/refs/heads/develop.zip
I did a quick check and the errors are still there.
I also tried it with another wordpress installation where no errors occur. So maybe it interferes with a plugin or configuration. I will have a look into this later this week and will tell you insights then.
Just a quick follow-up: Even with no other plugins activated beside the develop branch version of your plugin, the errors persist.
I tried it on two different wordpress installations with the same result. I looked into the code but since I am not really into wordpress plugin development, I do not really understand what is happening. It’s just strange that this:
apply_filters( Core\HOOK_PREFIX . 'debug_file', Core\DEBUG_FILE )
returns a path when WP_DEBUG is true but none if false. I would expect it to return a path no matter what is set since there is not condition around it. But, as said: I do not really understand the purpose of apply_filters.
This one:$debug = empty( $debug ) ? @ini_set( 'error_log', \WP_CONTENT_DIR . '/debug.log' ) : $debug;
sets an option in PHP when $debug is empty, right ? But it does not give anything back.
So $debug is still empty when entering:if ( false === file_exists( $debug ) ) { file_put_contents( $debug, '' ); }
And with that, it fails. Is that on purpose ?
Oops, you’re correct. I just updated to use the following.
$debug = empty( $debug ) ? \WP_CONTENT_DIR . '/debug.log' : $debug;
Download from same link above.
Sorry for my late reply, got busy with life.
The errors are still there. Wondering if I am doing something wrong on my end. But what else can I do than installing and setting options ?
I might have some time next week to play around more and try to see any other things which effect this plugin.Can you describe your server setup and is there anything other than a standard WordPress installation?
Can you install the WordPress Beta Tester plugin and utilize the ‘Report a Bug’ feature?
It’s a standard wordpress installation. Server should not have any extras, at least I do not know of any. After all, it’s a hosted webserver, so not sure if there are any settings different from standard, but so far no problems.
The “report a bug” gives:
== Bug Report === Description Describe the bug. === Environment - WordPress: 6.2.1-alpha-55679 - PHP: 8.0.28-he.0 - Server: Apache - Database: mysqli (Server: 5.7.41-44-log / Client: mysqlnd 8.0.28-he.0) - Browser: Chrome 112.0.0.0 (Windows 10/11) - Theme: Login Form Child 1.0 - MU-Plugins: None activated - Plugins: * Better Search Replace 1.4.2 * Childify Me 1.2.3 * CryptX 3.3.3.2 * IP2Location Country Blocker 2.28.9 * Password Protect WordPress Lite 1.8.8 * Simple Local Avatars 2.7.4 * Slimstat Analytics 5.0.4 * Statify 1.8.4 * Statify Filter 1.6.2 * Statify – Extended Evaluation 2.6.3 * Stream 3.9.2 * WordPress Beta Tester 3.3.7 * WP Debugging 2.11.20.4 * WP Word Count 3.2.4 === Steps to Reproduce 1. x. 🐞</img> Bug occurs. === Expected Results 1. ✅</img> What should happen. === Actual Results 1. ❌</img> What actually happened.
I noticed that I got 2 errors with the non-develop version of your plugin. With the develop version I get one, in a different location, I think. Here is, what I got (with version ….4):Fatal error: Uncaught ValueError: Path cannot be empty in /<path to wp>/wp-content/plugins/wp-debugging-develop/vendor/norcross/debug-quick-look/includes/parser.php:68 Stack trace: #0 /<path to wp>/wp-content/plugins/wp-debugging-develop/vendor/norcross/debug-quick-look/includes/parser.php(68): file('', 6) #1 /<path to wp>/wp-content/plugins/wp-debugging-develop/vendor/norcross/debug-quick-look/includes/parser.php(51): DebugQuickLook\Parser\parse_debug_file('') #2 /<path to wp>/wp-content/plugins/wp-debugging-develop/vendor/norcross/debug-quick-look/includes/actions.php(59): DebugQuickLook\Parser\run_parse() #3 /<path to wp>/wp-includes/class-wp-hook.php(308): DebugQuickLook\Actions\run_quicklook_action('') #4 /<path to wp>/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #5 /<path to wp>/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /<path to wp>/wp-admin/admin.php(175): do_action('admin_init') #7 /<path to wp>/wp-admin/index.php(10): require_once('<path to wp>') #8 {main} thrown in /<path to wp>/wp-content/plugins/wp-debugging-develop/vendor/norcross/debug-quick-look/includes/parser.php on line 68
OK, I went nuclear and pretty sure I’ve solved the issue now in the develop branch link above. Unfortunately it means if the debug.log file path cannot be found then Debug Quick Look doesn’t load.
- The topic ‘Uncaught Error: Path cannot be empty’ is closed to new replies.