PHP APD Completely Useless

Saturday, 2009-05-23 14:25, 1243088739 seconds since Unix epoch

We all know PHP isn’t a very well thought out programming language. It tries to do a lot of things, but fails to do most of those correctly.

PHP has a nice little extension, the Advanced PHP Debugger. APD for short. It allows you to analyze and alter PHP’s internals. It also supplies the rename_function function. Apart from it’s reversed name (it should be function_rename, like function_exists etc), it’s quite useful. It gives PHP some aspect oriented features, like allowing you to rename mysql_query to add transparent logging.

But PHP wouldn’t be PHP if they didn’t fuck this up. It’s okay to rename PHP’s own functions, but don’t try to rename your own.


jorrizza@shoebox:/tmp$ cat > balls.php
function foo() {
return 0;
}
rename_function('foo', 'original_foo');
var_dump(function_exists('original_foo'));
original_foo();
?>
^D
jorrizza@shoebox:/tmp$ php balls.php
bool(true)
Segmentation fault
jorrizza@shoebox:/tmp$

Kapow! Segfault! It’s even better when you’re using Apache mod_php. An apache child will segfault, making other mod_php processes behave quite strangely all of a sudden. This bug has been known since 2007, but nobody seems to care. It’s a Zend extension, we can’t support that, oh no.

One Response to “PHP APD Completely Useless”



  1. Bert Says:

    Haha, this language is goodNOT.

    I had a good laugh reading this one too:
    http://blog.iamnolegend.com/a-serious-php-design-flaw-watch-out-66.html

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>