From:             
Operating system: GNU linux/Debian
PHP version:      5.3.8
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:add call support to variables methods 'class::method' 
(spl_autoload also)

Description:
------------
variables static class::method (with autoload support) maybe useful to wrap
native vs php implementation (using function_exists) with clean O(1) code

if (function_exists('native_f'))
   $f = 'native_f';
else
   $f = 'class::static_f';

// some other file...
{
   global $f;
   $f($args);
}

// current workaround (slow 'n dirty)
$f = function() { return
forward_static_call_array('class::static_f',func_get_args()); };


Test script:
---------------
maybe_or_not.class.php:
class maybe_or_not {
        public static function f($a, $b) { return $a + $b; }
}
index.php:
spl_autoload_extensions('.class.php');
spl_autoload_register();
$f = "maybe_or_not::f";
printf("%d\n",$f(1,1)); // DON'T WORK (even if the class is already
loaded)


Expected result:
----------------
2

Actual result:
--------------
PHP Fatal error:  Call to undefined function maybe_or_not::f() in index.php

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60687&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60687&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60687&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60687&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60687&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60687&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60687&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60687&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60687&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60687&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60687&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60687&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60687&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60687&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60687&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60687&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60687&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60687&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60687&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60687&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60687&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60687&r=mysqlcfg

Reply via email to