php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47014 callbacks are not looked up in the current namespace
Submitted: 2009-01-05 23:22 UTC Modified: 2009-01-06 11:00 UTC
From: six at aegis-corp dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0alpha3 OS: Linux 2.6
Private report: No CVE-ID: None
 [2009-01-05 23:22 UTC] six at aegis-corp dot org
Description:
------------
functions that accept callbacks do not look up the current namespace when searching for the callback name. I have observed this with register_shutdown_function() and pcntl_signal() but it's probably more than these two.

sample code below works if we pass the fqn, ie: register_shutdown_function("test\\shutdown");

Reproduce code:
---------------
<?

namespace test;

function shutdown() {

        echo "bye\n";

}

register_shutdown_function("shutdown");

?>


Expected result:
----------------
bye

Actual result:
--------------
Warning: register_shutdown_function(): Invalid shutdown callback 'shutdown' passed in /root/php-5.3.0alpha3/ext/pcntl/- on line 11

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-06 11:00 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

We don't know where the string comes from, so we can't kow which cntext you mean...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 21:01:33 2025 UTC