From:             scout4u at ya dot ru
Operating system: 
PHP version:      5.4.4
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:last chance to work with __call by reference died after 
removing call-time-&

Description:
------------
As of PHP 5.4 our content management system became not working without 
possibility to get it to life. Beacause of a bug of removing call-time
passing 
by reference.

Explanation:
We have magical loading of «methods» in class as __call() - processed
launches:

__call:
        1. seeking existing of function If it exists — then function launches 
and everything is ok.
        2. If there is no such function — it's been loaded from _functions/ 
directory:
So we have auto-loading of functions.
BUT:
        Because of __call don't support (why???) references we could call our 
methods like this:
                $sm->test( &data );

and in test-function we were be able to work BY REFERENCE. In php53 there
was 
deprecations — ok, we were turning them off. BUT as of php54 we
completely can't 
load virtual function with passing reference nohow... at all.

Ok, we can to preload function if it doesn't exist. But we already can't
work by 
reference. So... in case of dealing with realy big array we will have to
push 
that into the function and COPY back to the original. This is a huge
CPU/memory 
consuming way.

Sooo... If there is no way to pass to the __call Maybe dear authors will
revert 
support (even with peprecation-errors) for future times exactly untill
__call 
could deal with reference (if that will never start working with reference
— 
maybe there should be way to work with __call at least by passing reference
in 
call-time maner?)

I belive that __call and its ability of working by reference is a criticaly

important (maybe not so usual happen) but important thing to leave in PHP
still 
working

Test script:
---------------
<?php
        class sm{
                function __call($n, $val){
                        if( !function_exists($n) )
                                include $n;
                        
                        return call_user_func($n, $val);  // call_user_func can 
not use
reference either. But everything works when we pass reference call-time.
                }
        }
        $sm = new sm();

        $data = array('prop'=>1);

        function test( &$d ){
                $d['prop'] = 2;
        }

        $sm->test( &$data );  // PHP 5.2, 5.3(deprecated) $data['prop'] === 2

        //!!!!!!!!! as of PHP54 this techinique will stop working and working by
reference to __call will not be working in all PHP-version as of 54.
        $sm->test( &$data );  // PHP 5.4(removed) fail


?>


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

Reply via email to