spatie / wordpress-ray

Debug with Ray to fix problems faster in WordPress apps
https://myray.app
MIT License
73 stars 14 forks source link

mu-plugin does not take precedence over global #78

Open Brugman opened 2 months ago

Brugman commented 2 months ago

source: https://myray.app/docs/php/vanilla-php/installation

To use framework specific functionality, such as viewing queries in Laravel, or displaying mails in WordPress, you should still install the relevant package or library.

If a framework specific package is detected, it will be used instead of the global Ray.

Is this still working in the case of WordPress?

My global installation is working, and my mu-plugin installation is working, tested on their own.

When both are active, running this in a custom plugin:

ray()->clearScreen();
ray('hello');
ray()->showHooks(); // WP only function
ray()->stopShowingHooks(); // WP only function

results in:

Fatal error:  Uncaught BadMethodCallException: Method showHooks does not exist. in phar://C:/Users/Tim/AppData/Roaming/Composer/vendor/spatie/global-ray/ray-phars/ray_php_8.0.phar/vendor/spatie/macroable/src/Macroable.php:42
Stack trace:
#0 C:\webdev\wptest3\public_html\wp-content\plugins\test\test.php(20): GlobalRay\Spatie\Ray\Ray->__call('showHooks', Array)
#1 C:\webdev\wptest3\public_html\wp-settings.php(517): include_once('C:\\webdev\\wptes...')
#2 C:\webdev\wptest3\public_html\wp-config.php(78): require_once('C:\\webdev\\wptes...')
#3 C:\webdev\wptest3\public_html\wp-load.php(50): require_once('C:\\webdev\\wptes...')
#4 C:\webdev\wptest3\public_html\wp-admin\admin.php(34): require_once('C:\\webdev\\wptes...')
#5 C:\webdev\wptest3\public_html\wp-admin\plugins.php(10): require_once('C:\\webdev\\wptes...')
#6 {main}
thrown in phar://C:/Users/Tim/AppData/Roaming/Composer/vendor/spatie/global-ray/ray-phars/ray_php_8.0.phar/vendor/spatie/macroable/src/Macroable.php on line 42

If I disable the global install:

; auto_prepend_file = C:\Users\Tim\AppData\Roaming\Composer\vendor\spatie\global-ray\src\scripts\global-ray-loader.php

Then it works.