zenovich / runkit

Runkit (official PECL PHP Runkit extension)
http://pecl.php.net/runkit
Other
611 stars 136 forks source link

Overriding System Class-Method - Segmentation Fault (11) #76

Closed jaydipdave closed 9 years ago

jaydipdave commented 9 years ago

Modified runkit_methods.c and removed all the restrictions to override system class and system functions. Compiled it working fine.

It also works fine, mostly. But sometimes, when frequently called, it give segmentation fault error.

My code below, I am using it with Cakephp framework.

runkit_method_copy('PDO','pprepare', 'PDO', 'prepare');
runkit_method_redefine('PDO','prepare', '$a,$ln=null', 'return PDO::pprepare($a,$ln);');

Any solution?

Thanks, Jaydeep

jaydipdave commented 9 years ago

Also sometimes:

zend_mm_heap corrupted

zenovich commented 9 years ago

Overriding system class-methods is prohibited since they are shared between all PHP threads. When you redefine method in one thread other threads' behaviour is unpredictable.