Renaming Functions during runtime in PHP.
        Posted  
        
            by The Rook
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by The Rook
        
        
        
        Published on 2010-05-17T02:26:36Z
        Indexed on 
            2010/05/17
            2:30 UTC
        
        
        Read the original article
        Hit count: 365
        
In PHP 5.3 is there a way to rename a function or "hook" a function.
There is the rename_function() within "APD" which has been broken since ~2004.  If you try and build it on PHP 5.3 you'll get this error:
'struct  _zend_compiler_globals' has no member named 'extended_info'
This is a really easy error to fix, just change this line:
GC(extended_info) = 1;
to
CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
I modified my php.ini and the APD shows up in my phpinfo() as it should.  However when i call rename_function() the PHP page doesn't load and I get a segmentation fault in my /var/log/apache2/error.log. 
Is there anyway to fix APD to work with a modern version of PHP? Or is there another method to rename functions? Why on earth is vital feature not in php!??!?! (Gotta love python :)
© Stack Overflow or respective owner