php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33903 spl_autoload_register class method
Submitted: 2005-07-28 14:02 UTC Modified: 2005-09-27 10:21 UTC
From: marcos dot neves at gmail dot com Assigned: helly (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5.1.0-rc1 OS: *
Private report: No CVE-ID: None
 [2005-07-28 14:02 UTC] marcos dot neves at gmail dot com
Description:
------------
What about spl_autoload_register accept class methods too, like usort and other php functions

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

class MyAutoLoader {

	function autoLoad($className) {
		// autload code
	}
}

spl_autoload_register(array('MyAutoLoader', 'autoLoad'));

// and

$myAutoLoader = new MyAutoLoader();
spl_autoload_register(array($myAutoLoader, 'autoLoad'));

?>

Expected result:
----------------
works!

Actual result:
--------------
Warning: spl_autoload_register() expects parameter 1 to be string, array given in C:\wamp\include_path\tests\spl\spl_autoload_register_class.test.php on line 10

Warning: spl_autoload_register() expects parameter 1 to be string, array given in C:\wamp\include_path\tests\spl\spl_autoload_register_class.test.php on line 15

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-28 20:41 UTC] helly@php.net
This has to be delayed until after 5.1 since it requires a complete reqrite of the internal function handling. Maybe staic functions are easier.
 [2005-09-21 12:11 UTC] helly@php.net
Implemented in HEAD please check.
 [2005-09-27 10:21 UTC] helly@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC