Thanks @justnorris!
I took a look through the patch and appreciate you’re taking the time to write it up and report it! Your attention to detail really helps out others a lot.
Notice & patch
I think I saw the notice you were referring to, but want to make sure the change I committed resolves the issue for you, so please check version 1.1.1 that was just deployed.
From what I could see in the error, the notice was being caused by PHP’s parse_url was not returning a path value for sites that were installed in the root directory. Rather than change where the plugin inits, I took the route of suppressing notices for that var, knowing it may or may not be in the array.
__CLASS__ vs. Class_Name::
While I can understand some advantages of using __CLASS__ to reference the current static class name (especially if the class is renamed), I prefer the Class_Name:: syntax to help give context while reading through the method.
Since this seemed to be more a matter of style preference than directly related to the notice, I left that change out. Please let me know if I missed a significant functional difference here, or if I’m not addressing the actual error you were!
Thanks & credit
Thanks for the excellent work! I have credited you and referenced this thread in the changelog.
Paul
PS: It looks like you’re on Github! You can find this and many of my other plugins at github.com/brainstormmedia and github.com/stylesplugin.
That cleans up only half the problem.
When the admin_init filter is added, the referenced class doesn’t go through in PHP 5.2.17
Warning: call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'UPB_Helpers::requirements_check' was given in /Sites/Dev/wp-includes/plugin.php on line 406
Call Stack
# Time Memory Function Location
1 0.0012 256368 {main}( ) ../upload.php:0
2 0.0022 388048 require_once( '/Sites/Dev/wp-admin/admin.php' ) ../upload.php:10
3 0.5306 40531568 do_action( ) ../admin.php:109
4 0.5359 40809304 call_user_func_array ( ) ../plugin.php:406
PHP 5.3.14 and 5.4.4 Says:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'UPB_Helpers' not found in /Sites/Dev/wp-includes/plugin.php on line 406
Call Stack
# Time Memory Function Location
1 0.0012 801040 {main}( ) ../upload.php:0
2 0.0019 917176 require_once( '/Sites/Dev/wp-admin/admin.php' ) ../upload.php:10
3 0.4476 40468832 do_action( ) ../admin.php:109
4 0.4525 40742072 call_user_func_array ( )
I think that means that PHP Doesn’t really like the way the class is being called later on.
Thanks. I see where that one was coming out now. Should be resolved in 1.1.2. The warning meant that the method was being called using static syntax, UPB_Helpers::requirements_check, but it wasn’t being declared as static.
Here’s the diff.
Duh. I didn’t notice that. Well – I’m glad it’s resolved now 🙂