Giter Site home page Giter Site logo

runkit's Introduction

Runkit extension for PHP

For all those things you.... probably shouldn't have been doing anyway.... but surely do!


Feel free to support Dmitry Zenovich via PayPal ([email protected]) if Runkit serves you. By making donation you invest in the project's future, helping it to be compatible with current PHP versions and to have less bugs and more features.

paypal


Runkit has three groups of features outlined below:

CUSTOM SUPERGLOBALS

A new .ini entry runkit.superglobal is defined which may be specified as a simple variable, or list of simple variables to be registered as superglobals. runkit.superglobal is defined as PHP_INI_SYSTEM and must be set in the system-wide php.ini.

Example:

php.ini:

runkit.superglobal=foo,bar

test.php:

function testme() {
  echo "Foo is $foo\n";
  echo "Bar is $bar\n";
  echo "Baz is $baz\n";
}
$foo = 1;
$bar = 2;
$baz = 3;

testme();

Outputs:

Foo is 1
Bar is 2
Baz is

Compatability: PHP 5.0 or greater

USER DEFINED FUNCTION AND CLASS MANIPULATION

Userdefined functions and userdefined methods may now be renamed, delete, and redefined using the API described at http://www.php.net/runkit

Examples for these functions may also be found in the tests folder.

Compatability: PHP5

SANDBOXING

With the introduction of TSRM based subinterpreter support a running PHP script may now generate a new thread and interactively switch contexts back and forth between it. THIS FEATURE DOES NOT PROVIDE FULL SCRIPT THREADING. This feature only allows you to run processes in a subinterpreter optionally with additional security.

First, create an instance of the Runkit_Sandbox object:

$php = new Runkit_Sandbox();

To read and write variables in this subinterpreter, just access the properties of the object:

$php->foo = 'bar';
$php->baz = 'boom';

Individual functions may also be called (executed within the newly created scope):

$php->session_start();

Or you can execute a block of arbitrary code:

$php->eval('echo "The value of foo is $foo\n";');

In this example, $foo will be interpolated as 'bar' since that's what you set it to earlier.

Certain INI Options which are ordinarily only modifiable in the system php.ini may be passed during instantiation and changed for your subinterpreter as well, these options are passed as an associative array to the Runkit_Sandbox constructor and include the following:

Setting Comment
safe_mode safe_mode may only be turned on for a Runkit_Sandbox interpreter using this option. It cannot be turned off, doing so would circumvent the setting specified by your system administrator in the system php.ini.
open_basedir Like safe_mode, you can only use this setting to make things more restrictive.
allow_url_fopen, allow_url_include In keeping with safe_mode, these can only be turned off (more restrictive than global environment)
disable_functions Any function names specified in this coma-delimited list will be disabled IN ADDITION TO already disabled functions
disable_classes Like disable_functions, this list is in addition to already disabled classes.

Sandboxing is ONLY AVAILABLE in PHP 5.1 (release version, or snapshot dated after April 28th, 2005) when thread safety has been enabled. To enable thread safety, just make sure that --enable-maintainer-zts is specified on your ./configure line. This doesn't necessarily mean that your SAPI will use PHP in a threaded manner, just that PHP is prepared to behave that way. If you're building for Apache2-Worker then you're already built for thread safety.

If you wish/need to use PHP 5.0.x, or a cvs snapshot of 5.1 which predates April 28th, you can apply the tsrm_5.0.diff patch included in this package:

cd /path/to/php-5.0.x/
cat /path/to/runkit/tsrm_5.0.diff | patch -p0

Then just rebuild using the --enable-maintainer-zts option specified above.

runkit_lint() and runkit_lint_file() also exist as a simpler approach to verifying the syntactic legality of passed code within an isolated environment.

BUILDING AND INSTALLING LATEST RELEASE WITH PECL IN UNIX

pecl install runkit

BUILDING AND INSTALLING CURRENT DEVELOPMENT VERSION IN UNIX

git clone https://github.com/zenovich/runkit.git
cd runkit
phpize
./configure
make
make test
sudo make install

BUILDING THE RUNKIT MODULE FOR WINDOWS

First, place source code of runkit into a temporary directory, for example "C:\runkit-source". Open your Windows SDK command prompt or Visual Studio Command prompt. Then change into the runkit's source code directory:

C:
cd C:\runkit-source

After that, run phpize from your PHP SDK. This may be something like

C:\php\SDK\phpize.bat

Then configure your runkit module by executing "configure". You can view the full list of options by the command

configure --help

but in most cases, you probably will choose a simple command

configure --enable-runkit

After all run

nmake

Now you should have the "php_runkit.dll" file.

runkit's People

Contributors

davidsteinsland avatar nateabele avatar remicollet avatar sgolemon avatar tony2001 avatar tysonandre avatar zenovich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

runkit's Issues

Support DESTDIR when building

The DESTDIR convention makes packaging significantly easier. I was trying to build an RPM of this package and found that make install puts files in /usr/lib, completely ignoring the DESTDIR environment variable, which effectively prevents me from creating an RPM at all.

Unable to redefine functions which return by reference, not value

I'm trying to use this extension with a Wordpress plugin which over-rides native Wordpress functionality which cannot be over-rode using a Drop-In plugin.

Wordpress functions appear to often return references instead of values such as 'function &get_pages($args = '')'. I cannot use 'runkit_function_redefine' to redefine such a function.

win32 vc9 ts compile error

Hi there,

I'm having a compile error in windows. Anyone could build it?

VC9 TS PHP 5.3.5

Thanks
Ricardo

Output:

runkit_sandbox_parent.c
.\runkit_sandbox_parent.c(97) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(98) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(108) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(109) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(132) : warning C4018: '<' : signed/unsigned mismatch
.\runkit_sandbox_parent.c(171) : error C2198: 'zend_is_callable' : too few arguments for call
.\runkit_sandbox_parent.c(187) : warning C4047: 'function' : 'void _**' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox_parent.c(187) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox_parent.c(187) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox_parent.c(187) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox_parent.c(187) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox_parent.c(187) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox_parent.c(187) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(187) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(218) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox_parent.c(218) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox_parent.c(218) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox_parent.c(218) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox_parent.c(218) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox_parent.c(218) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox_parent.c(218) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(218) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(281) : error C2198: 'zend_file_handle_dtor' : too few arguments for call
.\runkit_sandbox_parent.c(328) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox_parent.c(328) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox_parent.c(328) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox_parent.c(328) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox_parent.c(328) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox_parent.c(328) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox_parent.c(328) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(328) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(536) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox_parent.c(536) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox_parent.c(536) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox_parent.c(536) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox_parent.c(536) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox_parent.c(536) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox_parent.c(536) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(536) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(537) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(575) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox_parent.c(575) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox_parent.c(575) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox_parent.c(575) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox_parent.c(575) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox_parent.c(575) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox_parent.c(575) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(575) : error C2039: 'is_ref' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(610) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox_parent.c(683) : error C2039: 'refcount' : is not a member of '_zval_struct'
c:\php-sdk\php53dev\vc9\x86\php-5.3.5\zend\zend.h(316) : see declaration of '_zval_struct'
runkit_sandbox.c
.\runkit_sandbox.c(59) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox.c(59) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox.c(59) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox.c(59) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox.c(59) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox.c(59) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox.c(59) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(59) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(317) : warning C4013: 'php_request_startup' undefined; assuming extern returning int
.\runkit_sandbox.c(359) : error C2198: 'zend_is_callable' : too few arguments for call
.\runkit_sandbox.c(375) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox.c(375) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox.c(375) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox.c(375) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox.c(375) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox.c(375) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox.c(375) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(375) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(415) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox.c(415) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox.c(415) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox.c(415) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox.c(415) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox.c(415) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox.c(415) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(415) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(474) : error C2198: 'zend_file_handle_dtor' : too few arguments for call
.\runkit_sandbox.c(514) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox.c(514) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox.c(514) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox.c(514) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox.c(514) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox.c(514) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox.c(514) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(514) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(732) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox.c(732) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox.c(732) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox.c(732) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox.c(732) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable *'
.\runkit_sandbox.c(732) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox.c(732) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(732) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(733) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(769) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_sandbox.c(769) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_sandbox.c(769) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_sandbox.c(769) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_sandbox.c(769) : warning C4047: 'function' : 'int' differs in levels of indirection from 'HashTable '
.\runkit_sandbox.c(769) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_sandbox.c(769) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(769) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(806) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(880) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of 'zval_struct'
.\runkit_sandbox.c(928) : error C2198: 'zend_is_callable' : too few arguments for call
.\runkit_sandbox.c(990) : error C2198: 'zend_is_callable' : too few arguments for call
.\runkit_sandbox.c(1104) : error C2440: 'function' : cannot convert from 'sapi_headers_struct *' to 'sapi_header_op_enum'
.\runkit_sandbox.c(1104) : warning C4024: 'function through pointer' : different types for formal and actual parameter 2
.\runkit_sandbox.c(1104) : warning C4047: 'function' : 'sapi_headers_struct *' differs in levels of indirection from 'void *'
.\runkit_sandbox.c(1104) : warning C4024: 'function through pointer' : different types for formal and actual parameter 3
.\runkit_sandbox.c(1104) : error C2198: 'function through pointer' : too few arguments for call
.\runkit_sandbox.c(1178) : warning C4098: 'php_runkit_sandbox_sapi_register_server_variables' : 'void' function returning a value
.\runkit_sandbox.c(1395) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1396) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1402) : error C2198: 'zend_is_callable' : too few arguments for call
.\runkit_sandbox.c(1416) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1417) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1433) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1437) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1438) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1440) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1494) : error C2198: 'zend_is_callable' : too few arguments for call
.\runkit_sandbox.c(1502) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1517) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1559) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1559) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1560) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1560) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1561) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1561) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1562) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1562) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1563) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1563) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1564) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1564) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1565) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1565) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1566) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1566) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1567) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1567) : error C2039: 'is_ref' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1577) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1580) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1581) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1582) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1583) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1584) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1585) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1586) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1587) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1588) : warning C4133: 'initializing' : incompatible types - from 'void (cdecl *)(php_runkit_sandbox_object *,zval *,void *)' to 'int (cdecl *)(php_runkit_sandbox_object *,zval *,void *)'
.\runkit_sandbox.c(1623) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1659) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1695) : error C2039: 'refcount' : is not a member of '_zval_struct'
....\Zend\zend.h(316) : see declaration of '_zval_struct'
.\runkit_sandbox.c(1757) : warning C4013: 'php_request_shutdown' undefined; assuming extern returning int
.\runkit_sandbox.c(1828) : warning C4113: 'int (cdecl *)(sapi_header_struct *,sapi_headers_struct *,void *)' differs in parameter lists from 'int (cdecl *)(sapi_header_struct *,sapi_header_op_enum,sapi_headers_struct *,void *)'
runkit_methods.c
.\runkit_methods.c(213) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_methods.c(213) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_methods.c(213) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_methods.c(213) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_methods.c(213) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_methods.c(213) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_methods.c(262) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_methods.c(262) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_methods.c(262) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_methods.c(262) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_methods.c(262) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_methods.c(262) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_methods.c(348) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_methods.c(348) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_methods.c(348) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_methods.c(348) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_methods.c(348) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_methods.c(348) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_methods.c(407) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_methods.c(407) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_methods.c(407) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_methods.c(407) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_methods.c(407) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_methods.c(407) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_methods.c(459) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_methods.c(459) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_methods.c(459) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_methods.c(459) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_methods.c(459) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_methods.c(459) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_methods.c(504) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_methods.c(504) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_methods.c(504) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_methods.c(504) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_methods.c(504) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_methods.c(504) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
runkit_import.c
.\runkit_import.c(65) : error C2143: syntax error : missing ';' before 'type'
.\runkit_import.c(66) : error C2143: syntax error : missing ';' before 'type'
.\runkit_import.c(68) : error C2065: 'lcase' : undeclared identifier
.\runkit_import.c(68) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
.\runkit_import.c(68) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 1
.\runkit_import.c(68) : error C2065: 'lcase_len' : undeclared identifier
.\runkit_import.c(69) : error C2065: 'lcase' : undeclared identifier
.\runkit_import.c(69) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
.\runkit_import.c(69) : warning C4024: '_zend_hash_add_or_update' : different types for formal and actual parameter 2
.\runkit_import.c(69) : error C2065: 'lcase_len' : undeclared identifier
.\runkit_import.c(76) : error C2065: 'lcase' : undeclared identifier
.\runkit_import.c(76) : warning C4022: '_efree' : pointer mismatch for actual parameter 1
.\runkit_import.c(79) : error C2065: 'lcase' : undeclared identifier
.\runkit_import.c(79) : warning C4022: '_efree' : pointer mismatch for actual parameter 1
.\runkit_import.c(129) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_import.c(129) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_import.c(129) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_import.c(129) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_import.c(129) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_import.c(129) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_import.c(141) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_import.c(141) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_import.c(141) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_import.c(141) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_import.c(141) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_import.c(141) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_import.c(182) : warning C4013: 'ZVAL_ADDREF' undefined; assuming extern returning int
.\runkit_import.c(188) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_import.c(188) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_import.c(188) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_import.c(188) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_import.c(188) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_import.c(188) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_import.c(238) : warning C4047: 'function' : 'void *__' differs in levels of indirection from 'apply_func_args_t'
.\runkit_import.c(238) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_import.c(238) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_import.c(238) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_import.c(238) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_import.c(238) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
runkit_functions.c
.\runkit_functions.c(59) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char *
'
.\runkit_functions.c(59) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 1
.\runkit_functions.c(59) : warning C4047: 'function' : 'size_t' differs in levels of indirection from 'int '
.\runkit_functions.c(59) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 2
.\runkit_functions.c(146) : warning C4018: '<' : signed/unsigned mismatch
.\runkit_functions.c(186) : warning C4018: '<' : signed/unsigned mismatch
.\runkit_functions.c(297) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char *
'
.\runkit_functions.c(297) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 1
.\runkit_functions.c(297) : warning C4047: 'function' : 'size_t' differs in levels of indirection from 'int '
.\runkit_functions.c(297) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 2
.\runkit_functions.c(355) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char *
'
.\runkit_functions.c(355) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 1
.\runkit_functions.c(355) : warning C4047: 'function' : 'size_t' differs in levels of indirection from 'int '
.\runkit_functions.c(355) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 2
.\runkit_functions.c(451) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'char *
'
.\runkit_functions.c(451) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 1
.\runkit_functions.c(451) : warning C4047: 'function' : 'size_t' differs in levels of indirection from 'int '
.\runkit_functions.c(451) : warning C4024: 'php_strtolower' : different types for formal and actual parameter 2
runkit_constants.c
.\runkit_constants.c(71) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_constants.c(71) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_constants.c(71) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_constants.c(71) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_constants.c(71) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_constants.c(71) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_constants.c(74) : warning C4013: 'ZVAL_ADDREF' undefined; assuming extern returning int
.\runkit_constants.c(217) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_constants.c(217) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_constants.c(217) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_constants.c(217) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_constants.c(217) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_constants.c(217) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
runkit_classes.c
.\runkit_classes.c(35) : warning C4047: 'function' : 'void *' differs in levels of indirection from 'apply_func_args_t'
.\runkit_classes.c(35) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_classes.c(35) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_classes.c(35) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_classes.c(35) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_classes.c(35) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
.\runkit_classes.c(82) : warning C4047: 'function' : 'void *
' differs in levels of indirection from 'apply_func_args_t'
.\runkit_classes.c(82) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit_classes.c(82) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit_classes.c(82) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit_classes.c(82) : warning C4047: 'function' : 'int' differs in levels of indirection from 'zend_class_entry *'
.\runkit_classes.c(82) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
runkit.c
.\runkit.c(64) : warning C4013: 'ZVAL_REFCOUNT' undefined; assuming extern returning int
.\runkit.c(385) : warning C4047: 'function' : 'void *__' differs in levels of indirection from 'int (__cdecl *)(zend_internal_function *,int,va_list,zend_hash_key *)'
.\runkit.c(385) : warning C4022: 'zend_hash_apply_with_arguments' : pointer mismatch for actual parameter 2
.\runkit.c(385) : warning C4047: 'function' : 'apply_func_args_t' differs in levels of indirection from 'int'
.\runkit.c(385) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 3
.\runkit.c(385) : warning C4047: 'function' : 'int' differs in levels of indirection from 'void *
'
.\runkit.c(385) : warning C4024: 'zend_hash_apply_with_arguments' : different types for formal and actual parameter 4
Generating Code...
Build log was saved at "file://C:\php-sdk\php53dev\vc9\x86\php-5.3.5\ext\runkit\Release_TS\BuildLog.htm"
runkit - 81 error(s), 215 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

segfault with runkit_class_emancipate, runkit_class_adopt and phpunit

I'm trying the use runkit to replace the parent class of the class with a Mock version of it, which could make phpunit tests a bit simpler. Unfortunately I get a segfault when I try to execute the code. I put together a small testcase:

<?php

abstract class A
{

    public function to_be_mocked()
    {
        return 1;
    }

}

class B extends A
{

    public function foo()
    {
        return 1 + $this->to_be_mocked();
    }

}

class BTest extends PHPUnit_Framework_TestCase
{

    public function test()
    {
        $parent = $this->getMockForAbstractClass('A');

        runkit_class_emancipate('B');
        runkit_class_adopt('B', get_class($parent));

        $class = new B();

        $class->expects($this->once())
              ->method('to_be_mocked')
              ->will($this-returnValue(2));

        $this->assertSame(3, $class->foo());
    }

}

?>

running this using "phpunit testcase.php" gives:

PHPUnit 3.7.28 by Sebastian Bergmann.

Segmentation fault

Tested with php 5.5.7, phpunit 3.7.28 and runkit master.

Segfault on call renamed internal function

I do in my php code:

runkit_function_rename("var_dump","qwerty");

on php 5.3.3 got segmentation fault. Meanwhile very strange error was in php_strtolower (ext/standard/string.c:1315)
code:

while (c < e) {
    *c = tolower(*c); // <- here
    c++;
}

before, I thought something wrong with compiled code but next I've taken code from source and put into my own code and compiled it. Was the same. I've compiled two versions 0.9 and 1.0.2 and got same result.

okay, I've commented call of php_strtolower() and ran my php code again. but call of qwerty (renamed var_dump) taken segmentation fault. Still I haven't found any reasons

Can't replace a static method without compromising strict standards or doing runkit_import()

Hi all,

It would be great if runkit could replace a static methods the same way it replaces the non-static ones.
Right now replacing a static method with runkit_function_redefine() makes it non-static, so calling it later as a static generates a Strict Standards warning.

The only way I found to replace a static method (and keep it a static) is to do runkit_import() with RUNKIT_IMPORT_OVERRIDE flag to replace the original method.

Also, the behaviour of runkit_function_redefine() with static methods is not documented - I think it should!

Crashes with runkit_function_rename() on internal functions on php-mod mode

echo "function exists ? " . function_exists('_chop') . "<br>";
echo chop("[ A WORD ") . "]<br>";
if (function_exists('_chop')) echo _chop("[ ANOTHER WORD ") . "]<br>";
runkit_function_rename('chop', '_chop');

If I refresh the page executing this script quickly (less than 5 seconds, as apache can use the same process for the next script execution than the previous one) :

  • first result is "function exists ?" without any error :
function exists ? 
[ A WORD]
  • after some F5 : next results will be "function exists ? 1" with a warning when I rename saying "_chop() already exists".
function exists ? 1
[ A WORD]
[ ANOTHER WORD]

It looks like php kept in its memory the _chop function, that keep working well !
This is done with internal functions only. Php defined functions work well.

Tested and reproduced on several computers under xubuntu 13.10 using PHP 5.5.3, installed as an apache module (common use).

And you can make an runkit_method_delete('_chop') if you want : it will not be here for the current script, but will come back on the next execution using the same process !

I don't want to run php-cgi, sorry :)

Emancipate and adopt do not appear to change class hierarchy

Minimal code to reproduce the problem:

class myParent {}
class myUncle {}
class myChild extends myParent {}
runkit_class_emancipate("myChild");
runkit_class_adopt("myChild", "myUncle");```

The above results in an error:

PHP Warning: runkit_class_adopt(): Class mychild already has a parent

Explanation of what is expected from the code

class myParent {}
class myUncle {}
class myChild extends myParent {}
echo get_parent_class("myChild") . "\n";
runkit_class_emancipate("myChild");
//  Now expect myChild to have no parent...
echo get_parent_class("myChild") . "\n";
//  Actual output is still myParent.
//  Emancipated myChild, so should be able to adopt myUncle...
runkit_class_adopt("myChild", "myUncle");
//  Actual result is:
//      PHP Warning:  runkit_class_adopt(): Class mychild already has a parent
echo get_parent_class("myChild") . "\n";
//  Parent of myChild is still myParent - expected to be myUncle by now.```

Comparison of output

The above example produces:

myParent
myParent
PHP Warning:  runkit_class_adopt(): Class mychild already has a parent
myParent

It should produce:

myParent
(blank)
myUncle

Summary

Although the methods are being changed (i.e. inherited methods are removed from myChild when emancipated), the class hierarchy does not appear to be altered. Therefore, there is no way to actually change the ancestry of a class.

Versions

I have tried this with the Runkit 1.0.0 from SVN and also the Runkit 1.0.3-dev from Git, with the same result.

In both cases, I am using PHP 5.3.3.7 on Debian Squeeze (PHP installed from APT as a package, and Runkit applied using PECL).

Also perhaps with noting that this is an x86_64 system, and the tests have been run through CLI (not through a webserver).

Output from phpinfo()

runkit

runkit support => enabled
version => 1.0.3-dev
Custom Superglobal support => enabled
Sandbox Support => disable or unavailable
Runtime Manipulation => enabled

tsrm_ls compile error with vc6/php5.2

When I compile using vc6 on windows against the latest zenovich/runkit on php5.2.X, I get the following error:

runkit_functions.c(263) : error C2143: syntax error : missing ';' before 'type'
runkit_functions.c(269) : error C2065: 'tsrm_ls' : undeclared identifier

I found a reference here: http://flylib.com/books/en/2.565.1.14/1/ (bottom of that page) which indicated that the tsrm declarations might need to go before anything else. I moved the tsrm_ls definition up a few lines in the same method and it appeared to solve the compilation problem. I don't know enough to know if that makes any difference in the overall functionality

_OLD_

    if (!hash_key->nKeyLength) {
        /* Nonsense, skip it */
        return ZEND_HASH_APPLY_REMOVE;
    }

#if (RUNKIT_UNDER53)
    void ***tsrm_ls = va_arg(args, void***); /* NULL when !defined(ZTS) */
#endif

_NEW_

#if (RUNKIT_UNDER53)
    void ***tsrm_ls = va_arg(args, void***); /* NULL when !defined(ZTS) */
#endif

    if (!hash_key->nKeyLength) {
        /* Nonsense, skip it */
        return ZEND_HASH_APPLY_REMOVE;
    }

Thanks for the great functionality.

Regards,
Steven Balthazor

Can't install via pecl and PHP 5.4.9 on Ubuntu 13.04

sudo pecl install https://github.com/downloads/zenovich/runkit/runkit-1.0.3.tgz

This is reported to work for others, but with PHP 5.4 I get some errors. You can see them below. I tried pointing to an archive from master but got different errors. I would wager that it's because archives of commit hashes have a "runkit-HASHNAMEHERE" directory in them, under which are all of the files I'd expect at the top level.

As a workaround I have compressed up a copy of the git repository and I'm hosting it on my server, but it would be fantastic to have version 1.0.4 released.

running: make
/bin/bash /tmp/pear/temp/pear-build-root5ZhCA4/runkit-1.0.3/libtool --mode=compile cc  -I. -I/tmp/pear/temp/runkit -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root5ZhCA4/runkit-1.0.3/include -I/tmp/pear/temp/pear-build-root5ZhCA4/runkit-1.0.3/main -I/tmp/pear/temp/runkit -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/runkit/runkit.c -o runkit.lo
libtool: compile:  cc -I. -I/tmp/pear/temp/runkit -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root5ZhCA4/runkit-1.0.3/include -I/tmp/pear/temp/pear-build-root5ZhCA4/runkit-1.0.3/main -I/tmp/pear/temp/runkit -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/runkit/runkit.c  -fPIC -DPIC -o .libs/runkit.o
/tmp/pear/temp/runkit/runkit.c: In function 'php_runkit_register_auto_global':
/tmp/pear/temp/runkit/runkit.c:285:2: warning: passing argument 3 of 'zend_register_auto_global' makes integer from pointer without a cast [enabled by default]
In file included from /usr/include/php5/Zend/zend_modules.h:26:0,
                 from /usr/include/php5/Zend/zend_API.h:26,
                 from /usr/include/php5/main/php.h:39,
                 from /tmp/pear/temp/runkit/php_runkit.h:29,
                 from /tmp/pear/temp/runkit/runkit.c:22:
/usr/include/php5/Zend/zend_compile.h:683:14: note: expected 'zend_bool' but argument is of type 'void *'
/tmp/pear/temp/runkit/runkit.c:285:2: error: too few arguments to function 'zend_register_auto_global'
In file included from /usr/include/php5/Zend/zend_modules.h:26:0,
                 from /usr/include/php5/Zend/zend_API.h:26,
                 from /usr/include/php5/main/php.h:39,
                 from /tmp/pear/temp/runkit/php_runkit.h:29,
                 from /tmp/pear/temp/runkit/runkit.c:22:
/usr/include/php5/Zend/zend_compile.h:683:14: note: declared here
/tmp/pear/temp/runkit/runkit.c: In function 'zm_deactivate_runkit':
/tmp/pear/temp/runkit/runkit.c:378:3: warning: passing argument 2 of 'zend_hash_apply' from incompatible pointer type [enabled by default]
In file included from /usr/include/php5/Zend/zend.h:271:0,
                 from /usr/include/php5/main/php.h:35,
                 from /tmp/pear/temp/runkit/php_runkit.h:29,
                 from /tmp/pear/temp/runkit/runkit.c:22:
/usr/include/php5/Zend/zend_hash.h:138:15: note: expected 'apply_func_t' but argument is of type 'int (*)(char *)'
/tmp/pear/temp/runkit/runkit.c:388:3: warning: passing argument 2 of 'zend_hash_apply' from incompatible pointer type [enabled by default]
In file included from /usr/include/php5/Zend/zend.h:271:0,
                 from /usr/include/php5/main/php.h:35,
                 from /tmp/pear/temp/runkit/php_runkit.h:29,
                 from /tmp/pear/temp/runkit/runkit.c:22:
/usr/include/php5/Zend/zend_hash.h:138:15: note: expected 'apply_func_t' but argument is of type 'int (*)(struct zend_hash_key *)'
/tmp/pear/temp/runkit/runkit.c:396:3: warning: passing argument 2 of 'zend_hash_apply_with_arguments' from incompatible pointer type [enabled by default]
In file included from /usr/include/php5/Zend/zend.h:271:0,
                 from /usr/include/php5/main/php.h:35,
                 from /tmp/pear/temp/runkit/php_runkit.h:29,
                 from /tmp/pear/temp/runkit/runkit.c:22:
/usr/include/php5/Zend/zend_hash.h:140:15: note: expected 'apply_func_args_t' but argument is of type 'int (*)(struct zend_internal_function *, int,  struct __va_list_tag *, struct zend_hash_key *)'
make: *** [runkit.lo] Error 1

Runkit + APC

Hi,

Using APC with runkit's runkit_method_redefine makes the script execution crash (silently stop).
I'm happy to provide any more information, just tell me what, 'cause I'm not quite sure.

Sandbox: how to run _precompiled_ arbitrary code in child?

I want to run precompiled code in child like this: $sandbox->call_user_func(function() {foo();});
$sandbox->eval() causes compilation of source-code to bytecode. How to bypass it?
I have just one idea... $sandbox->include() + eAccelerator. Is there another way?

Can't add or rename a method that will override a parent method

class Class1 {
    function method()
    {
        echo "method1\n";
    }
}
class Class2 extends Class1 {
}

runkit_method_add('Class2', 'method', '', 'parent::method(); echo "method2\n";');

This crashes with a runkit_method_add(): Unable to add method to class warning.

I can code this workaround in PHP, which seems to be working, but it would be better if runkit correctly detects that the method can be added into Class2 :

runkit_method_rename('Class1', 'method', 'method_tmp');
runkit_method_add('Class2', 'method', '', 'parent::method(); echo "method2\n";');
runkit_method_rename('Class1', 'method_tmp', 'method');

Notice : if some parents have this method too, they must be all renamed to tmp, and renamed back from the child to the highest parent.

Protected access function don't work after rename

class Test
{
    protected function func1()
    {
        echo "func1<br>";
    }
}

runkit_method_add('Test', 'func2', '', 'echo "func2<br>"; $this->func1();', RUNKIT_ACC_PUBLIC);
echo "this works :<br>";
(new Test())->func2();

runkit_method_rename('Test', 'func1', '_func1');
runkit_method_redefine('Test', 'func2', '', 'echo "new func2<br>"; $this->_func1();', RUNKIT_ACC_PUBLIC);
echo "this crashes :<br>";
(new Test())->func2();

This displays
Fatal error: Call to protected method Test::func1() from context 'Test' in tests/runkit.php on line 13

After func1 is renamed, it seems that func2 or any method (declared with or without runkit) from Test can not access it anymore (with its new name of course). It is a protected method, so it should be found.

How PHP 5.5 does make the protected access control :
https://github.com/php/php-src/blob/250ee4c17a40eb79b4057374384b8669e803636a/Zend/zend_object_handlers.c
and search from context

Can't compile; Gentoo, PHP 5.3, libtool 2.4 error

I want to create a new ebuild for Gentoo but I cannot get this to compile.

./configure works, either manually or with pecl install

I get this issue upon make:

/bin/sh /home/tatsh/dev/runkit/libtool --mode=compile cc  -I. -I/home/tatsh/dev/runkit -DPHP_ATOM_INC -I/home/tatsh/dev/runkit/include -I/home/tatsh/dev/runkit/main -I/home/tatsh/dev/runkit -I/usr/lib64/php5.3/include/php -I/usr/lib64/php5.3/include/php/main -I/usr/lib64/php5.3/include/php/TSRM -I/usr/lib64/php5.3/include/php/Zend -I/usr/lib64/php5.3/include/php/ext -I/usr/lib64/php5.3/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /home/tatsh/dev/runkit/runkit.c -o runkit.lo 
/home/tatsh/dev/runkit/libtool: line 481: CDPATH: command not found
libtool: Version mismatch error.  This is libtool 2.4, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4
libtool: and run autoconf again.
make: *** [runkit.lo] Error 63

Any ideas?

ReflectionFunction + runkit segfaults

Самый простой тест-кейс:

invokeArgs(array("test")); ?>

Вариация на тему:

invokeArgs(array("test")); ?>

Чуть сложнее:

getDeclaringFunction()); var_dump((string)$rp); ?>

Всё, в общем, логично - reflection хранит старый указатель, а runkit ему делает free (верней, zend_hash_update()) и подменяет его другим.

Fully qualified class names not found by runkit_method_* functions

When using a fully qualified name (akin to `\Namespace\Class' - note backslash at start) runkit_method_* functions appears as if it does not find the class.

Consider following:

<?php

class A
{
  public static function fn()
  {
    printf("Hello, world!\n");
  }
}

\A::fn();
runkit_method_remove('\A', 'fn');

This gives the following output:

Hello, world!
PHP Warning:  runkit_method_remove(): class \a not found in /h/alexo/a.php on line 12
PHP Stack trace:
PHP   1. {main}() /h/alexo/a.php:0
PHP   2. runkit_method_remove() /h/alexo/a.php:12
PHP Warning:  runkit_method_remove(): Unknown method \a::fn() in /h/alexo/a.php on line 12
PHP Stack trace:
PHP   1. {main}() /h/alexo/a.php:0
PHP   2. runkit_method_remove() /h/alexo/a.php:12

So, \A does specify a class, but not recognized by runkit (Removing the leading \ gives expected result)

php -v gives:

PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug  6 2012 14:18:06) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
    with test_helpers v1.0.1-dev, Copyright (c) 2009-2010, by Johannes Schlueter, Scott MacVicar, Sebastian Bergmann

runkit version is 1.0.3.

license, release, etc.

Hi!

Thanks for your work on this extension!

Some comments:

  • License changes cannot be done without asking every single contributor
    . restore the PHP License please (and the next comment allows you that)
  • Please keep releasing it under PECL
    . it can be done while having the code repository on github (all my new exts are on github for example)

Cheers!

feature request/bug for anonymous function

First, thank you for this tool. It's wonderful!

I was just playing in the interactive mode; php -a
Php crash when referencing a redefine function from an anonymous function. Here is what I mean:

php > function greet(){echo "hey";}
php > greet();
hey
php > runkit_function_redefine("greet",'$name',"echo "hey $name\n";");
php > greet("you");
hey you
php > function parent(){ $localvar = "john"; $af = function() use ($localvar){greet($localvar);}; return $af;}
php > $greet1 = parent();
php > $greet1();
hey john
php > runkit_function_redefine("greet",'$name',"echo "hello $name\n";");
php > $greet1();
segmentation fault

unable to call runkit_class_adopt multiple times on single class

If I call following code using runkit from actual master branch (2013-03-20) the second call of runkit_class_adopt() function does not work. With runkit-1.0.3 it works fine.

class myParent {
  function parentFunc() {
    echo "Parent Function Output\n";
  }
}

class myParent2 {
  function parentFunc2() {
    echo "Parent 2 Function Output\n";
  }
}

class myChild {
}

runkit_class_adopt('myChild','myParent');
print_r(get_class_methods('myChild'));

runkit_class_adopt('myChild','myParent2');
print_r(get_class_methods('myChild'));

Expected result

(works with runkit-1.0.3 and older)

Array
(
    [0] => parentFunc
)
Array
(
    [0] => parentFunc
    [1] => parentFunc2
)

Actual result

Array
(
    [0] => parentFunc
)
Warning: runkit_class_adopt(): Class myChild already has a parent in /var/lib/frafos-sbc-gui/webmin-module/runkit.php.cgi on line 22 
Array
(
    [0] => parentFunc
)

_POST request are ignored with runkit 1.0.4-dev

Hi

Since I've upgraded to PHP 5.4.x, I now also needed to upgrade to the latest runkit branch. But now, POST requests won't work anymore. The $_POST array is always empty. The POST data is also missing in the _REQUEST array.

When I do a test posting, I'm getting the following results:

with runkit enabled:
$_SERVER["REQUEST_METHOD"] : POST

with runkit disabled the post request is working fine:
$_SERVER["REQUEST_METHOD"] : POST
$_POST["TEST"] = test
$_REQUEST["TEST"] = test

Is there a solution for this issue?

Versioning

It would be great if the package would have something like versions with downloadable archives.
It will be much better than downloading master-branch from here everytime.
At least it would be nice to put them onto the "Downloads" page.

Было бы просто замечательно если у пакета появится что-то вроде версий, с
архивами для скачивания.
Вместо того чтобы качать все время master-ветку отсюда.

В те же Downloads положить хотя бы.

Overload `new` and `exit`

The test_helpers plugin provides useful functionality that I'd love to see here in runkit. Is there a way you can grab its code to overload the new operator and exit so I can switch my legacy code tests over entirely to runkit? Its license is MIT and the github project is at https://github.com/sebastianbergmann/php-test-helpers. It compiles against PHP 5.4 but the function renaming doesn't work well in the updated PHP version.

Fatal error when trying to call overloaded internal function

I'm using runkit in combination with phpunit for unit testing. I updated to the latest git version after I moved to php 5.4 an d now I occassionally errors like this while running phpunit:

Fatal error: Cannot call overloaded function for non-object in ...

This happens when I try to call a php internal function, mail(), that was overloaded before with runkit_function_redefine().
The error seems to have some correlation to the amount of tests I enable in phpunit. If I restrict it to the test that causes the issue it only happens sometimes and other times it works fine. If I enable a bigger set of tests it happens every time.

Crash on creating Runkit_Sandbox

The code

$sandbox = new \Runkit_Sandbox();

Causes php to segfault, here is the backtrace
#0 cgi_php_import_environment_variables (array_ptr=0x37405d0, tsrm_ls=0x35e6a90) at /usr/src/php-5.3.2/sapi/cgi/cgi_main.c:628
#1 0x00000000008010fe in sapi_cgi_register_variables (track_vars_array=0x7f6b1c12de40, tsrm_ls=0x7fff089b5530) at /usr/src/php-5.3.2/sapi/cgi/cgi_main.c:651
#2 0x0000000000725c57 in php_register_server_variables (name=0x29a32e0 "_SERVER", name_len=7, tsrm_ls=0x35e6a90) at /usr/src/php-5.3.2/main/php_variables.c:581
#3 php_auto_globals_create_server (name=0x29a32e0 "_SERVER", name_len=7, tsrm_ls=0x35e6a90) at /usr/src/php-5.3.2/main/php_variables.c:772
#4 0x00000000007526a5 in zend_is_auto_global (name=, name_len=, tsrm_ls=0x35e6a90) at /usr/src/php-5.3.2/Zend/zend_compile.c:4919
#5 0x00007f6b1a37e011 in zm_activate_xdebug (type=1, module_number=45, tsrm_ls=0x35e6a90) at /tmp/pear/temp/xdebug/xdebug.c:736
#6 0x00000000007750bf in module_registry_request_startup (module=0x2c5b850, tsrm_ls=0x0) at /usr/src/php-5.3.2/Zend/zend_API.c:2134
#7 0x000000000077bcbc in zend_hash_apply (ht=0xefcc60, apply_func=0x7750a0 <module_registry_request_startup>, tsrm_ls=0x35e6a90) at /usr/src/php-5.3.2/Zend/zend_hash.c:673
#8 0x0000000000714682 in php_request_startup (tsrm_ls=) at /usr/src/php-5.3.2/main/main.c:1441
#9 0x00007f6b167418ab in zim_Runkit_Sandbox___construct (ht=, return_value=0x35e6c70, return_value_ptr=,

this_ptr=<value optimized out>, return_value_used=<value optimized out>, tsrm_ls=<value optimized out>) at /tmp/pear/temp/runkit/runkit_sandbox.c:320

#10 0x00007f6b1a381b35 in xdebug_execute_internal (current_execute_data=0x7f6b1f3596a8, return_value_used=0, tsrm_ls=0x298c1b0) at /tmp/pear/temp/xdebug/xdebug.c:1339
#11 0x00000000007c4f00 in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6b1f3596a8, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:315
#12 0x0000000000797513 in execute (op_array=0x3527460, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:104
#13 0x00007f6b1a3813f9 in xdebug_execute (op_array=0x3527460, tsrm_ls=0x298c1b0) at /tmp/pear/temp/xdebug/xdebug.c:1272
#14 0x00000000007c4b3a in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6b1f359458, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:337
#15 0x0000000000797513 in execute (op_array=0x3525fd0, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:104
#16 0x00007f6b1a3813f9 in xdebug_execute (op_array=0x3525fd0, tsrm_ls=0x298c1b0) at /tmp/pear/temp/xdebug/xdebug.c:1272
#17 0x00000000007c4b3a in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6b1f353d88, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:337
#18 0x0000000000797513 in execute (op_array=0x309dbd0, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:104
#19 0x00007f6b1a3813f9 in xdebug_execute (op_array=0x309dbd0, tsrm_ls=0x298c1b0) at /tmp/pear/temp/xdebug/xdebug.c:1272
#20 0x00000000007c4b3a in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6b1f353b80, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:337
#21 0x0000000000797513 in execute (op_array=0x30c13c0, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:104
#22 0x00007f6b1a3813f9 in xdebug_execute (op_array=0x30c13c0, tsrm_ls=0x298c1b0) at /tmp/pear/temp/xdebug/xdebug.c:1272
#23 0x00000000007c4b3a in zend_do_fcall_common_helper_SPEC (execute_data=0x7f6b1f353030, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:337
#24 0x0000000000797513 in execute (op_array=0x2da9d90, tsrm_ls=0x298c1b0) at /usr/src/php-5.3.2/Zend/zend_vm_execute.h:104
#25 0x00007f6b1a3813f9 in xdebug_execute (op_array=0x2da9d90, tsrm_ls=0x298c1b0) at /tmp/pear/temp/xdebug/xdebug.c:1272
#26 0x000000000076e5bc in zend_execute_scripts (type=8, tsrm_ls=0x298c1b0, retval=, file_count=3) at /usr/src/php-5.3.2/Zend/zend.c:1194
#27 0x0000000000713043 in php_execute_script (primary_file=, tsrm_ls=) at /usr/src/php-5.3.2/main/main.c:2260
#28 0x000000000080271d in main (argc=, argv=) at /usr/src/php-5.3.2/sapi/cgi/cgi_main.c:2102

I am using php-5.3.2 with these extensions

mongo, pecl_http, memcache, geoip, imagick, xdebug

PHP was compiled with the following configure line

./configure --prefix=/usr/local/php --enable-mbstring --with-gettext --enable-exif --with-mysqli --enable-soap --with-openssl --with-readline --enable-sockets --with-zlib --with-imap --with-kerberos --with-imap-ssl --with-curl --enable-maintainer-zts

runkit_import() crashes.

Hello, Dmitry. I got this:

PHP Warning: runkit_import(): Inconsistency cleaning up import environment in /home/web/phpdaemon/lib/Daemon_WorkerThread.class.php on line 220
phpd: worker process : symbol lookup error: /usr/lib64/extensions/no-debug-non-zts-20090626/runkit.so: undefined symbol: ZVAL_ADDREF

How to deal with it?
runkit_import() is really great for phpDaemon, it might allow live source-updating without reloadings.
Thank you for your time.

P.S. с меня бутылка

MSHUTDOWN segfaults

Runkit segfaults during module shutdown (in cli).

Commenting out this line works for me (current master version): zval_ptr_dtor(&RUNKIT_G(removed_parameter_str_zval));

but I think it's kind unrelated ;)

PHP version: PHP 5.4.6

Behaviour can be observed while running complex PHP tools like PHPUnit or CodeSniffer

build fails on PHP 5.4.1

I try to build your extension under Gentoo with PHP 5.4.1-rc1-pl0-gentoo and the "pecl install package.xml" fails, with the errors:

libtool: compile: cc -I. -I/tmp/runkit -DPHP_ATOM_INC -I/tmp/pear-build-rootElLcXk/runkit-1.0.4/include -I/tmp/pear-build-rootElLcXk/runkit-1.0.4/main -I/tmp/runkit -I/usr/lib/php5.4/include/php -I/usr/lib/php5.4/include/php/main -I/usr/lib/php5.4/include/php/TSRM -I/usr/lib/php5.4/include/php/Zend -I/usr/lib/php5.4/include/php/ext -I/usr/lib/php5.4/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/runkit/runkit.c -fPIC -DPIC -o .libs/runkit.o
/tmp/runkit/runkit.c: In function 'php_runkit_register_auto_global':
/tmp/runkit/runkit.c: 295 : 2: warning: passing argument 3 of 'zend_register_auto_global' makes integer from pointer without a cast
/usr/lib/php5.4/include/php/Zend/zend_compile.h:685:14: note: expected 'zend_bool' but argument is of type 'void '
/tmp/runkit/runkit.c: 295 : 2: error: too few arguments to function 'zend_register_auto_global'
/usr/lib/php5.4/include/php/Zend/zend_compile.h:685:14: note: declared here
/tmp/runkit/runkit.c: In function 'zm_deactivate_runkit':
/tmp/runkit/runkit.c: 388 : 3: warning: passing argument 2 of 'zend_hash_apply' from incompatible pointer type
/usr/lib/php5.4/include/php/Zend/zend_hash.h:138:15: note: expected 'apply_func_t' but argument is of type 'int (
)(char )'
/tmp/runkit/runkit.c: 398 : 3: warning: passing argument 2 of 'zend_hash_apply' from incompatible pointer type
/usr/lib/php5.4/include/php/Zend/zend_hash.h:138:15: note: expected 'apply_func_t' but argument is of type 'int (
)(struct zend_hash_key )'
/tmp/runkit/runkit.c: 406 : 3: warning: passing argument 2 of 'zend_hash_apply_with_arguments' from incompatible pointer type
/usr/lib/php5.4/include/php/Zend/zend_hash.h:140:15: note: expected 'apply_func_args_t' but argument is of type 'int (
)(struct zend_internal_function , int, char *, struct zend_hash_key *)'
make: *
* [runkit.lo] Error 1
ERROR: `make' failed

Segmentation fault when runkit_import overwrites private or protected static properties modifed via reflection

A segmentation fault occurs when using runkit_import to reset private or protected static properties that were modifed via reflection. The server is running PHP 5.3.3 with Zend Engine v2.3.0 and runkit was updated with the master branch on 10/19/2012.

TestClass.php (class to be reloaded)

class TestClass{
   private static $property;
}

TestReload.php (class to duplicate error)

require_once('TestClass.php');

$oTestReload = new TestReload('TestClass');
unset($oTestReload);

class TestReload{

   private $refClass;

   public function TestReload($sClass){
      
      $this->refClass = new ReflectionClass($sClass);
      
      // Verify default property values
      $this->GetProperties();
   
      // Change property values
      $this->SetProperties('test');

      // Verify property values were changed
      $this->GetProperties();
      
      // Reload class
      $oReload = new Reload('TestClass.php');
      unset($oReload);

      // Verify the property values were reset to default
      $this->GetProperties();

      unset($this->refClass);
   }
   
   private function GetProperties(){
      $aProps = $this->refClass->getStaticProperties();
      var_dump($aProps);
   }
   
   private function SetProperties($sValue){
      $aProps = $this->refClass->getStaticProperties();
      foreach($aProps as $sKey => $oProp){
         $refProp = $this->refClass->getProperty($sKey);
         $refProp->setAccessible(true);
         $refProp->setValue($sValue);
         unset($refProp);
      }
   }
}

class Reload{
   public function Reload($sClassPath){
      runkit_import($sClassPath, (RUNKIT_IMPORT_OVERRIDE|RUNKIT_IMPORT_CLASS_STATIC_PROPS));
   }
}

result

array(1) {
  ["property"]=>
  NULL
}
array(1) {
  ["property"]=>
  string(4) "test"
}
Segmentation fault

expected result

array(1) {
  ["property"]=>
  NULL
}
array(1) {
  ["property"]=>
  string(4) "test"
}
array(1) {
  ["property"]=>
  NULL
}

gdb results

Program terminated with signal 11, Segmentation fault.
#0  0x00007f480f7c28ca in php_runkit_import_class_static_props (ht=, return_value=0x2675928, return_value_ptr=, 
    this_ptr=, return_value_used=) at /home/test/runkit/runkit_import.c:287
287                                     || (Z_TYPE_PP(pp) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT

gdb backtrace

#0  0x00007f480f7c28ca in php_runkit_import_class_static_props (ht=, return_value=0x2675928, return_value_ptr=, 
    this_ptr=, return_value_used=) at /home/test/runkit/runkit_import.c:287
#1  php_runkit_import_classes (ht=, return_value=0x2675928, return_value_ptr=, this_ptr=, 
    return_value_used=) at /home/test/runkit/runkit_import.c:490
#2  zif_runkit_import (ht=, return_value=0x2675928, return_value_ptr=, this_ptr=, 
    return_value_used=) at /home/test/runkit/runkit_import.c:679
#3  0x00007f4813f3c00e in xdebug_execute_internal () from /usr/lib64/php/modules/xdebug.so
#4  0x00000000005f5266 in ?? ()
#5  0x00000000005cc780 in execute ()
#6  0x00007f4813f3bcc7 in xdebug_execute () from /usr/lib64/php/modules/xdebug.so
#7  0x00000000005f4f66 in ?? ()
#8  0x00000000005cc780 in execute ()
#9  0x00007f4813f3bcc7 in xdebug_execute () from /usr/lib64/php/modules/xdebug.so
#10 0x00000000005f4f66 in ?? ()
#11 0x00000000005cc780 in execute ()
#12 0x00007f4813f3bcc7 in xdebug_execute () from /usr/lib64/php/modules/xdebug.so
#13 0x00000000005a6ebd in zend_execute_scripts ()
#14 0x0000000000555128 in php_execute_script ()
#15 0x0000000000630bf5 in ?? ()
#16 0x0000003c7ae1ecdd in __libc_start_main () from /lib64/libc.so.6
#17 0x0000000000421ea9 in _start ()

Please let me know if you need anything else. Your help is greatly appreciated.

Jon

Side affect when redefine constant

When the name of the constant is stored in a variable, the variable value after the call runkit_constant_redefine() goes bad. That is, somehow lost one colon. Moreover, copy to another variable does not help.

Sample code to reproduce:

Can't import class extending another class

parents are empty array - class haven't got parent functions

I wrote test to check if error is in code or not

TEST

--TEST--
runkit_import() Importing and overriding classes extending another loaded class
--SKIPIF--

--FILE--

ver(); unset($Test); //load it once more to override runkit_import(dirname(**FILE**) . '/my.inc', RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE); $Test = new Test; $Test->ver(); $Test->aaa(); ?>

--EXPECTF--
n
n
n

FILE my.inc

ver(); } } Here is saved result (with another test for testing interfaces but this hasn't good result I don't know this error message ) # ## FAILED TEST SUMMARY runkit_import() Importing and overriding classes extending another loaded class [tests/runkit_import_class_extend.phpt] # runkit_import() Importing classes implementing interface [tests/runkit_import_class_iface.phpt] # ## TEST RESULT SUMMARY Exts skipped : 0 ## Exts tested : 44 Number of tests : 152 142 Tests skipped : 10 ( 6.6%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 2 ( 1.3%) ( 1.4%) Expected fail : 0 ( 0.0%) ( 0.0%) ## Tests passed : 140 ( 92.1%) ( 98.6%) Time taken : 9 seconds ## FAILED TEST SUMMARY runkit_import() Importing and overriding classes extending another loaded class [tests/runkit_import_class_extend.phpt] runkit_import() Importing classes implementing interface [tests/runkit_import_class_iface.phpt] /home/mido/Stažené/runkit-master/tests/runkit_import_class_extend.phpt Fatal error: Call to undefined method Test::ver() in /home/mido/Stažené/runkit-master/tests/runkit_import_class_extend.php on line 10 001+ Fatal error: Call to undefined method Test::ver() in /home/mido/Stažené/runkit-master/tests/runkit_import_class_extend.php on line 10 001- n 002- n 003- n /home/mido/Stažené/runkit-master/tests/runkit_import_class_iface.phpt hh jj 002+ jj # # BUILD ENVIRONMENT OS: Linux - Linux mido-G31M-ES2L 3.2.0-40-generic-pae #64-Ubuntu SMP Mon Mar 25 21:44:41 UTC 2013 i686 Autoconf: autoconf (GNU Autoconf) 2.68 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html, http://gnu.org/licenses/exceptions.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille. Bundled Libtool: ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56) Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. System Libtool: libtool (GNU libtool) 2.4.2 Written by Gordon Matzigkeit [email protected], 1996 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiler: Using built-in specs. COLLECT_GCC=cc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) Bison: bison (GNU Bison) 2.5 Napsali Robert Corbett a Richard Stallman, český překlad Marv. Autorská práva (C) 2011 Free Software Foundation, Inc. Toto je svobodné programové vybavení; podmínky pro kopírování a rozšiřování naleznete ve zdrojových textech. Toto programové vybavení je zcela BEZ ZÁRUKY, a to i bez záruky PRODEJNOSTI nebo VHODNOSTI PRO NĚJAKÝ KONKRÉTNÍ ÚČEL. Libraries: linux-gate.so.1 => (0x40022000) libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0x4004d000) libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0x40063000) libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x4007c000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x40161000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x4018d000) libicui18n.so.48 => /usr/lib/libicui18n.so.48 (0x40192000) libicuuc.so.48 => /usr/lib/libicuuc.so.48 (0x40369000) libxml2.so.2 => /usr/lib/i386-linux-gnu/libxml2.so.2 (0x404cf000) libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x4061c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x4063a000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x40655000) /lib/ld-linux.so.2 (0x40000000) libicudata.so.48 => /usr/lib/libicudata.so.48 (0x407fe000) # # PHPINFO phpinfo() PHP Version => 5.4.13 System => Linux mido-G31M-ES2L 3.2.0-40-generic-pae #64-Ubuntu SMP Mon Mar 25 21:44:41 UTC 2013 i686 Build Date => Mar 26 2013 17:53:57 Configure Command => './configure' '--enable-ctype' '--enable-com_dotnet' '--enable-calendar' '--enable-bz2' '--enable-bcmath' '--enable-fileinfo' '--enable-exif' '--enable-ereg' '--enable-enchant' '--enable-dom' '--enable-dba' '--enable-date' '--enable-curl' '--enable-iconv' '--enable-hash' '--enable-gmp' '--enable-gettext' '--enable-gd' '--enable-ftp' '--enable-filter' '--enable-mbstring' '--enable-libxml' '--enable-ldap' '--enable-json' '--enable-intl' '--enable-interbase' '--enable-imap' '--enable-mysqlnd' '--enable-mysqli' '--enable-mysql' '--enable-mssql' '--enable-mcrypt' '--enable-phar' '--enable-pgsql' '--enable-pdo_sqlite' '--enable-pdo_pgsql' '--enable-pdo_odbc' '--enable-pdo_oci' '--enable-pdo_mysql' '--enable-pdo_firebird' '--enable-pdo_dblib' '--enable-pdo' '--enable-pcre' '--enable-pcntl' '--enable-openssl' '--enable-odbc' '--enable-oci8' '--enable-recode' '--enable-readline' '--enable-pspell' '--enable-posix' '--enable-soap' '--enable-snmp' '--enable-skeleton' '--enable-simplexml' '--enable-shmop' '--enable-session' '--enable-reflection' '--enable-spl' '--enable-sockets' '--enable-standard' '--enable-sqlite3' '--enable-tidy' '--enable-sysvshm' '--enable-sysvsem' '--enable-sysvmsg' '--enable-sybase_ct' '--enable-zip' '--enable-xsl' '--enable-xmlwriter' '--enable-xmlrpc' '--enable-xmlreader' '--enable-xml' '--enable-wddx' '--enable-tokenizer' '--enable-zlib' '--enable-maintainer-zts' Server API => Command Line Interface Virtual Directory Support => enabled Configuration File (php.ini) Path => /usr/local/lib Loaded Configuration File => /usr/local/lib/php.ini Scan this dir for additional .ini files => (none) Additional .ini files parsed => (none) PHP API => 20100412 PHP Extension => 20100525 Zend Extension => 220100525 Zend Extension Build => API220100525,TS PHP Extension Build => API20100525,TS Debug Build => no Thread Safety => enabled Zend Signal Handling => disabled Zend Memory Manager => enabled Zend Multibyte Support => provided by mbstring IPv6 Support => enabled DTrace Support => disabled Registered PHP Streams => php, file, glob, data, http, ftp, zip, compress.zlib, phar Registered Stream Socket Transports => tcp, udp, unix, udg Registered Stream Filters => convert.iconv._, string.rot13, string.toupper, string.tolower, string.strip_tags, convert._, consumed, dechunk, zlib.* This program makes use of the Zend Scripting Language Engine: Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies --- Configuration apc APC Support => disabled Version => 3.1.13 APC Debugging => Disabled MMAP Support => Enabled MMAP File Mask => Locking type => pthread read/write Locks Serialization Support => broken Revision => $Revision: 327136 $ Build Date => May 1 2013 02:56:00 Directive => Local Value => Master Value apc.cache_by_default => On => On apc.canonicalize => On => On apc.coredump_unmap => Off => Off apc.enable_cli => Off => Off apc.enabled => On => On apc.file_md5 => Off => Off apc.file_update_protection => 2 => 2 apc.filters => no value => no value apc.gc_ttl => 3600 => 3600 apc.include_once_override => Off => Off apc.lazy_classes => Off => Off apc.lazy_functions => Off => Off apc.max_file_size => 1M => 1M apc.mmap_file_mask => no value => no value apc.num_files_hint => 1000 => 1000 apc.preload_path => no value => no value apc.report_autofilter => Off => Off apc.rfc1867 => Off => Off apc.rfc1867_freq => 0 => 0 apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS apc.rfc1867_prefix => upload_ => upload_ apc.rfc1867_ttl => 3600 => 3600 apc.serializer => default => default apc.shm_segments => 1 => 1 apc.shm_size => 32M => 32M apc.shm_strings_buffer => 4M => 4M apc.slam_defense => On => On apc.stat => On => On apc.stat_ctime => Off => Off apc.ttl => 0 => 0 apc.use_request_time => On => On apc.user_entries_hint => 4096 => 4096 apc.user_ttl => 0 => 0 apc.write_lock => On => On bcmath BCMath support => enabled Directive => Local Value => Master Value bcmath.scale => 0 => 0 calendar Calendar support => enabled Core PHP Version => 5.4.13 Directive => Local Value => Master Value allow_url_fopen => On => On allow_url_include => Off => Off always_populate_raw_post_data => Off => Off arg_separator.input => & => & arg_separator.output => & => & asp_tags => Off => Off auto_append_file => no value => no value auto_globals_jit => On => On auto_prepend_file => no value => no value browscap => no value => no value default_charset => no value => no value default_mimetype => text/html => text/html disable_classes => no value => no value disable_functions => pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, => pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, display_errors => STDERR => STDERR display_startup_errors => Off => Off doc_root => no value => no value docref_ext => no value => no value docref_root => no value => no value enable_dl => On => On enable_post_data_reading => On => On error_append_string => no value => no value error_log => no value => no value error_prepend_string => no value => no value error_reporting => 24575 => 24575 exit_on_timeout => Off => Off expose_php => On => On extension_dir => /usr/local/lib/php/extensions/no-debug-zts-20100525/ => /usr/local/lib/php/extensions/no-debug-zts-20100525/ file_uploads => On => On highlight.comment => #FF8000 => #FF8000 highlight.default => #0000BB => #0000BB highlight.html => #000000 => #000000 highlight.keyword => #007700 => #007700 highlight.string => #DD0000 => #DD0000 html_errors => Off => Off ignore_repeated_errors => Off => Off ignore_repeated_source => Off => Off ignore_user_abort => Off => Off implicit_flush => On => On include_path => .:/usr/local/lib/php => .:/usr/local/lib/php log_errors => On => On log_errors_max_len => 1024 => 1024 mail.add_x_header => On => On mail.force_extra_parameters => no value => no value mail.log => no value => no value max_execution_time => 0 => 0 max_file_uploads => 20 => 20 max_input_nesting_level => 64 => 64 max_input_time => -1 => -1 max_input_vars => 1000 => 1000 memory_limit => 128M => 128M open_basedir => no value => no value output_buffering => 0 => 0 output_handler => no value => no value post_max_size => 8M => 8M precision => 14 => 14 realpath_cache_size => 16K => 16K realpath_cache_ttl => 120 => 120 register_argc_argv => On => On report_memleaks => On => On report_zend_debug => Off => Off request_order => GP => GP sendmail_from => no value => no value sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i serialize_precision => 17 => 17 short_open_tag => On => On SMTP => localhost => localhost smtp_port => 25 => 25 sql.safe_mode => Off => Off track_errors => Off => Off unserialize_callback_func => no value => no value upload_max_filesize => 2M => 2M upload_tmp_dir => no value => no value user_dir => no value => no value user_ini.cache_ttl => 300 => 300 user_ini.filename => .user.ini => .user.ini variables_order => GPCS => GPCS xmlrpc_error_number => 0 => 0 xmlrpc_errors => Off => Off zend.detect_unicode => On => On zend.enable_gc => On => On zend.multibyte => Off => Off zend.script_encoding => no value => no value ctype ctype functions => enabled curl cURL support => enabled cURL Information => 7.22.0 Age => 3 Features AsynchDNS => No Debug => No GSS-Negotiate => Yes IDN => Yes IPv6 => Yes Largefile => Yes NTLM => Yes SPNEGO => No SSL => Yes SSPI => No krb4 => No libz => Yes CharConv => No Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet, tftp Host => i686-pc-linux-gnu SSL Version => OpenSSL/1.0.1 ZLib Version => 1.2.3.4 date date/time support => enabled "Olson" Timezone Database Version => 2012.10 Timezone Database => internal Default timezone => UTC Directive => Local Value => Master Value date.default_latitude => 31.7667 => 31.7667 date.default_longitude => 35.2333 => 35.2333 date.sunrise_zenith => 90.583333 => 90.583333 date.sunset_zenith => 90.583333 => 90.583333 date.timezone => no value => no value dba DBA support => enabled Supported handlers => cdb cdb_make inifile flatfile Directive => Local Value => Master Value dba.default_handler => flatfile => flatfile dom DOM/XML => enabled DOM/XML API Version => 20031129 libxml Version => 2.7.8 HTML Support => enabled XPath Support => enabled XPointer Support => enabled Schema Support => enabled RelaxNG Support => enabled ereg Regex Library => Bundled library enabled exif EXIF Support => enabled EXIF Version => 1.4 $Id$ Supported EXIF Version => 0220 Supported filetypes => JPEG,TIFF Directive => Local Value => Master Value exif.decode_jis_intel => JIS => JIS exif.decode_jis_motorola => JIS => JIS exif.decode_unicode_intel => UCS-2LE => UCS-2LE exif.decode_unicode_motorola => UCS-2BE => UCS-2BE exif.encode_jis => no value => no value exif.encode_unicode => ISO-8859-15 => ISO-8859-15 fileinfo fileinfo support => enabled version => 1.0.5 filter Input Validation and Filtering => enabled Revision => $Id: 2aa8dd57d9c0c655cd45e6e5872bb95fa5ad76cf $ Directive => Local Value => Master Value filter.default => unsafe_raw => unsafe_raw filter.default_flags => no value => no value ftp FTP support => enabled hash hash support => enabled Hashing Engines => md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b fnv132 fnv164 joaat haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5 iconv iconv support => enabled iconv implementation => glibc iconv library version => 2.15 Directive => Local Value => Master Value iconv.input_encoding => ISO-8859-1 => ISO-8859-1 iconv.internal_encoding => ISO-8859-1 => ISO-8859-1 iconv.output_encoding => ISO-8859-1 => ISO-8859-1 intl Internationalization support => enabled version => 1.1.0 ICU version => 4.8.1.1 ICU Data version => 4.8.1 Directive => Local Value => Master Value intl.default_locale => no value => no value intl.error_level => 0 => 0 json json support => enabled json version => 1.2.1 libxml libXML support => active libXML Compiled Version => 2.7.8 libXML Loaded Version => 20708 libXML streams => enabled mbstring Multibyte Support => enabled Multibyte string engine => libmbfl HTTP input encoding translation => disabled libmbfl version => 1.3.2 mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1. Multibyte (japanese) regex support => enabled Multibyte regex (oniguruma) backtrack check => On Multibyte regex (oniguruma) version => 4.7.1 Directive => Local Value => Master Value mbstring.detect_order => no value => no value mbstring.encoding_translation => Off => Off mbstring.func_overload => 0 => 0 mbstring.http_input => pass => pass mbstring.http_output => pass => pass mbstring.http_output_conv_mimetypes => ^(text/|application/xhtml+xml) => ^(text/|application/xhtml+xml) mbstring.internal_encoding => no value => no value mbstring.language => neutral => neutral mbstring.strict_detection => Off => Off mbstring.substitute_character => no value => no value memcache memcache support => enabled Active persistent connections => 0 Version => 2.2.7 Revision => $Revision: 327750 $ Directive => Local Value => Master Value memcache.allow_failover => 1 => 1 memcache.chunk_size => 8192 => 8192 memcache.default_port => 11211 => 11211 memcache.default_timeout_ms => 1000 => 1000 memcache.hash_function => crc32 => crc32 memcache.hash_strategy => standard => standard memcache.max_failover_attempts => 20 => 20 mysql MySQL Support => enabled Active Persistent Links => 0 Active Links => 0 Client API version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $ Directive => Local Value => Master Value mysql.allow_local_infile => On => On mysql.allow_persistent => On => On mysql.connect_timeout => 60 => 60 mysql.default_host => no value => no value mysql.default_password => no value => no value mysql.default_port => no value => no value mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock mysql.default_user => no value => no value mysql.max_links => Unlimited => Unlimited mysql.max_persistent => Unlimited => Unlimited mysql.trace_mode => Off => Off mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $ Compression => not supported SSL => supported Command buffer size => 4096 Read buffer size => 32768 Read timeout => 31536000 Collecting statistics => Yes Collecting memory statistics => No Tracing => n/a Loaded plugins => mysqlnd,example,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password API Extensions => mysql mysqlnd statistics => bytes_sent => 0 bytes_received => 0 packets_sent => 0 packets_received => 0 protocol_overhead_in => 0 protocol_overhead_out => 0 bytes_received_ok_packet => 0 bytes_received_eof_packet => 0 bytes_received_rset_header_packet => 0 bytes_received_rset_field_meta_packet => 0 bytes_received_rset_row_packet => 0 bytes_received_prepare_response_packet => 0 bytes_received_change_user_packet => 0 packets_sent_command => 0 packets_received_ok => 0 packets_received_eof => 0 packets_received_rset_header => 0 packets_received_rset_field_meta => 0 packets_received_rset_row => 0 packets_received_prepare_response => 0 packets_received_change_user => 0 result_set_queries => 0 non_result_set_queries => 0 no_index_used => 0 bad_index_used => 0 slow_queries => 0 buffered_sets => 0 unbuffered_sets => 0 ps_buffered_sets => 0 ps_unbuffered_sets => 0 flushed_normal_sets => 0 flushed_ps_sets => 0 ps_prepared_never_executed => 0 ps_prepared_once_executed => 0 rows_fetched_from_server_normal => 0 rows_fetched_from_server_ps => 0 rows_buffered_from_client_normal => 0 rows_buffered_from_client_ps => 0 rows_fetched_from_client_normal_buffered => 0 rows_fetched_from_client_normal_unbuffered => 0 rows_fetched_from_client_ps_buffered => 0 rows_fetched_from_client_ps_unbuffered => 0 rows_fetched_from_client_ps_cursor => 0 rows_affected_normal => 0 rows_affected_ps => 0 rows_skipped_normal => 0 rows_skipped_ps => 0 copy_on_write_saved => 0 copy_on_write_performed => 0 command_buffer_too_small => 0 connect_success => 0 connect_failure => 0 connection_reused => 0 reconnect => 0 pconnect_success => 0 active_connections => 0 active_persistent_connections => 0 explicit_close => 0 implicit_close => 0 disconnect_close => 0 in_middle_of_command_close => 0 explicit_free_result => 0 implicit_free_result => 0 explicit_stmt_close => 0 implicit_stmt_close => 0 mem_emalloc_count => 0 mem_emalloc_amount => 0 mem_ecalloc_count => 0 mem_ecalloc_amount => 0 mem_erealloc_count => 0 mem_erealloc_amount => 0 mem_efree_count => 0 mem_efree_amount => 0 mem_malloc_count => 0 mem_malloc_amount => 0 mem_calloc_count => 0 mem_calloc_amount => 0 mem_realloc_count => 0 mem_realloc_amount => 0 mem_free_count => 0 mem_free_amount => 0 mem_estrndup_count => 0 mem_strndup_count => 0 mem_estndup_count => 0 mem_strdup_count => 0 proto_text_fetched_null => 0 proto_text_fetched_bit => 0 proto_text_fetched_tinyint => 0 proto_text_fetched_short => 0 proto_text_fetched_int24 => 0 proto_text_fetched_int => 0 proto_text_fetched_bigint => 0 proto_text_fetched_decimal => 0 proto_text_fetched_float => 0 proto_text_fetched_double => 0 proto_text_fetched_date => 0 proto_text_fetched_year => 0 proto_text_fetched_time => 0 proto_text_fetched_datetime => 0 proto_text_fetched_timestamp => 0 proto_text_fetched_string => 0 proto_text_fetched_blob => 0 proto_text_fetched_enum => 0 proto_text_fetched_set => 0 proto_text_fetched_geometry => 0 proto_text_fetched_other => 0 proto_binary_fetched_null => 0 proto_binary_fetched_bit => 0 proto_binary_fetched_tinyint => 0 proto_binary_fetched_short => 0 proto_binary_fetched_int24 => 0 proto_binary_fetched_int => 0 proto_binary_fetched_bigint => 0 proto_binary_fetched_decimal => 0 proto_binary_fetched_float => 0 proto_binary_fetched_double => 0 proto_binary_fetched_date => 0 proto_binary_fetched_year => 0 proto_binary_fetched_time => 0 proto_binary_fetched_datetime => 0 proto_binary_fetched_timestamp => 0 proto_binary_fetched_string => 0 proto_binary_fetched_blob => 0 proto_binary_fetched_enum => 0 proto_binary_fetched_set => 0 proto_binary_fetched_geometry => 0 proto_binary_fetched_other => 0 init_command_executed_count => 0 init_command_failed_count => 0 com_quit => 0 com_init_db => 0 com_query => 0 com_field_list => 0 com_create_db => 0 com_drop_db => 0 com_refresh => 0 com_shutdown => 0 com_statistics => 0 com_process_info => 0 com_connect => 0 com_process_kill => 0 com_debug => 0 com_ping => 0 com_time => 0 com_delayed_insert => 0 com_change_user => 0 com_binlog_dump => 0 com_table_dump => 0 com_connect_out => 0 com_register_slave => 0 com_stmt_prepare => 0 com_stmt_execute => 0 com_stmt_send_long_data => 0 com_stmt_close => 0 com_stmt_reset => 0 com_stmt_set_option => 0 com_stmt_fetch => 0 com_deamon => 0 bytes_received_real_data_normal => 0 bytes_received_real_data_ps => 0 example statistics => stat1 => 0 stat2 => 0 pcntl pcntl support => enabled pcre PCRE (Perl Compatible Regular Expressions) Support => enabled PCRE Library Version => 8.31 2012-07-06 Directive => Local Value => Master Value pcre.backtrack_limit => 1000000 => 1000000 pcre.recursion_limit => 100000 => 100000 PDO PDO support => enabled PDO drivers => sqlite pdo_sqlite PDO Driver for SQLite 3.x => enabled SQLite Library => 3.7.7.1 Phar Phar: PHP Archive support => enabled Phar EXT version => 2.0.1 Phar API version => 1.1.1 SVN revision => $Id: c5042cc34acebcc0926625b57dff03deebbe6472 $ Phar-based phar archives => enabled Tar-based phar archives => enabled ZIP-based phar archives => enabled gzip compression => enabled bzip2 compression => disabled (install pecl/bz2) OpenSSL support => disabled (install ext/openssl) Phar based on pear/PHP_Archive, original concept by Davey Shafik. Phar fully realized by Gregory Beaver and Marcus Boerger. Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle. Directive => Local Value => Master Value phar.cache_list => no value => no value phar.readonly => On => On phar.require_hash => On => On posix Revision => $Id: 32db6705f5b617967a546be3114e178a4138c1ca $ pthreads Version => 0.44 Reflection Reflection => enabled Version => $Id: 25ecbad68e5a4573ffee43ea24a0591ea179492a $ runkit runkit support => enabled version => 1.0.4-dev Custom Superglobal support => enabled Sandbox Support => enabled Runtime Manipulation => enabled Directive => Local Value => Master Value runkit.internal_override => Off => Off runkit.superglobal => no value => no value scream scream support => enabled extension version => 0.1.0 Directive => Local Value => Master Value scream.enabled => Off => Off session Session Support => enabled Registered save handlers => files user memcache Registered serializer handlers => php php_binary wddx Directive => Local Value => Master Value session.auto_start => Off => Off session.cache_expire => 180 => 180 session.cache_limiter => nocache => nocache session.cookie_domain => no value => no value session.cookie_httponly => Off => Off session.cookie_lifetime => 0 => 0 session.cookie_path => / => / session.cookie_secure => Off => Off session.entropy_file => /dev/urandom => /dev/urandom session.entropy_length => 0 => 0 session.gc_divisor => 1000 => 1000 session.gc_maxlifetime => 1440 => 1440 session.gc_probability => 0 => 0 session.hash_bits_per_character => 5 => 5 session.hash_function => 0 => 0 session.name => PHPSESSID => PHPSESSID session.referer_check => no value => no value session.save_handler => files => files session.save_path => no value => no value session.serialize_handler => php => php session.upload_progress.cleanup => On => On session.upload_progress.enabled => On => On session.upload_progress.freq => 1% => 1% session.upload_progress.min_freq => 1 => 1 session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS session.upload_progress.prefix => upload_progress_ => upload_progress_ session.use_cookies => On => On session.use_only_cookies => On => On session.use_trans_sid => 0 => 0 shmop shmop support => enabled SimpleXML Simplexml support => enabled Revision => $Id: 692516840b2d7d6e7aedb0bedded1f53b764a99f $ Schema support => enabled soap Soap Client => enabled Soap Server => enabled Directive => Local Value => Master Value soap.wsdl_cache => 1 => 1 soap.wsdl_cache_dir => /tmp => /tmp soap.wsdl_cache_enabled => 1 => 1 soap.wsdl_cache_limit => 5 => 5 soap.wsdl_cache_ttl => 86400 => 86400 sockets Sockets Support => enabled SPL SPL support => enabled Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException sqlite3 SQLite3 support => enabled SQLite3 module version => 0.7 SQLite Library => 3.7.7.1 Directive => Local Value => Master Value sqlite3.extension_dir => no value => no value standard Dynamic Library Support => enabled Path to sendmail => /usr/sbin/sendmail -t -i Directive => Local Value => Master Value assert.active => 1 => 1 assert.bail => 0 => 0 assert.callback => no value => no value assert.quiet_eval => 0 => 0 assert.warning => 1 => 1 auto_detect_line_endings => 0 => 0 default_socket_timeout => 60 => 60 from => no value => no value url_rewriter.tags => a=href,area=href,frame=src,input=src,form=fakeentry => a=href,area=href,frame=src,input=src,form=fakeentry user_agent => no value => no value sysvmsg sysvmsg support => enabled Revision => $Id: e268047b695fe9a43cdf415c429729252347becd $ tokenizer Tokenizer Support => enabled wddx WDDX Support => enabled WDDX Session Serializer => enabled xml XML Support => active XML Namespace Support => active libxml2 Version => 2.7.8 xmlreader XMLReader => enabled xmlwriter XMLWriter => enabled zip Zip => enabled Extension Version => $Id: 727cc853ca1ae15d995c3520c5719784ddc1e292 $ Zip version => 1.11.0 Libzip version => 0.10.1 zlib ZLib Support => enabled Stream Wrapper => compress.zlib:// Stream Filter => zlib.inflate, zlib.deflate Compiled Version => 1.2.3.4 Linked Version => 1.2.3.4 Directive => Local Value => Master Value zlib.output_compression => Off => Off zlib.output_compression_level => -1 => -1 zlib.output_handler => no value => no value Additional Modules Module Name sysvsem sysvshm Environment Variable => Value SUDO_GID => 1000 MAIL => /var/mail/root USER => root SSH_CLIENT => deleted SHLVL => 1 TEST_PHP_SRCDIR => /home/mido/Stažené/runkit-master HOME => /home/mido OLDPWD => /home/mido/Stažené/runkit-master SSH_TTY => deleted MAKEFLAGS => SUDO_UID => 1000 LOGNAME => root TEST_PHP_EXECUTABLE => /usr/local/bin/php _ => /usr/local/bin/php TERM => xterm USERNAME => root PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAKELEVEL => 1 DISPLAY => :3 LANG => cs_CZ.UTF-8 LS_COLORS => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:_.tar=01;31:_.tgz=01;31:_.arj=01;31:_.taz=01;31:_.lzh=01;31:_.lzma=01;31:_.tlz=01;31:_.txz=01;31:_.zip=01;31:_.z=01;31:_.Z=01;31:_.dz=01;31:_.gz=01;31:_.lz=01;31:_.xz=01;31:_.bz2=01;31:_.bz=01;31:_.tbz=01;31:_.tbz2=01;31:_.tz=01;31:_.deb=01;31:_.rpm=01;31:_.jar=01;31:_.war=01;31:_.ear=01;31:_.sar=01;31:_.rar=01;31:_.ace=01;31:_.zoo=01;31:_.cpio=01;31:_.7z=01;31:_.rz=01;31:_.jpg=01;35:_.jpeg=01;35:_.gif=01;35:_.bmp=01;35:_.pbm=01;35:_.pgm=01;35:_.ppm=01;35:_.tga=01;35:_.xbm=01;35:_.xpm=01;35:_.tif=01;35:_.tiff=01;35:_.png=01;35:_.svg=01;35:_.svgz=01;35:_.mng=01;35:_.pcx=01;35:_.mov=01;35:_.mpg=01;35:_.mpeg=01;35:_.m2v=01;35:_.mkv=01;35:_.webm=01;35:_.ogm=01;35:_.mp4=01;35:_.m4v=01;35:_.mp4v=01;35:_.vob=01;35:_.qt=01;35:_.nuv=01;35:_.wmv=01;35:_.asf=01;35:_.rm=01;35:_.rmvb=01;35:_.flc=01;35:_.avi=01;35:_.fli=01;35:_.flv=01;35:_.gl=01;35:_.dl=01;35:_.xcf=01;35:_.xwd=01;35:_.yuv=01;35:_.cgm=01;35:_.emf=01;35:_.axv=01;35:_.anx=01;35:_.ogv=01;35:_.ogx=01;35:_.aac=00;36:_.au=00;36:_.flac=00;36:_.mid=00;36:_.midi=00;36:_.mka=00;36:_.mp3=00;36:_.mpc=00;36:_.ogg=00;36:_.ra=00;36:_.wav=00;36:_.axa=00;36:_.oga=00;36:_.spx=00;36:_.xspf=00;36: XAUTHORITY => /home/mido/.Xauthority SUDO_COMMAND => /usr/bin/make test SSH_AUTH_SOCK => deleted SHELL => /bin/bash SUDO_USER => mido PWD => /home/mido/Stažené/runkit-master SSH_CONNECTION => deleted CC => cc MFLAGS => PHP Variables Variable => Value _SERVER["SUDO_GID"] => 1000 _SERVER["MAIL"] => /var/mail/root _SERVER["USER"] => root _SERVER["SSH_CLIENT"] => deleted _SERVER["SHLVL"] => 1 _SERVER["TEST_PHP_SRCDIR"] => /home/mido/Stažené/runkit-master _SERVER["HOME"] => /home/mido _SERVER["OLDPWD"] => /home/mido/Stažené/runkit-master _SERVER["SSH_TTY"] => deleted _SERVER["MAKEFLAGS"] => _SERVER["SUDO_UID"] => 1000 _SERVER["LOGNAME"] => root _SERVER["TEST_PHP_EXECUTABLE"] => /usr/local/bin/php _SERVER["_"] => /usr/local/bin/php _SERVER["TERM"] => xterm _SERVER["USERNAME"] => root _SERVER["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin _SERVER["MAKELEVEL"] => 1 _SERVER["DISPLAY"] => :3 _SERVER["LANG"] => cs_CZ.UTF-8 _SERVER["LS_COLORS"] => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:_.tar=01;31:_.tgz=01;31:_.arj=01;31:_.taz=01;31:_.lzh=01;31:_.lzma=01;31:_.tlz=01;31:_.txz=01;31:_.zip=01;31:_.z=01;31:_.Z=01;31:_.dz=01;31:_.gz=01;31:_.lz=01;31:_.xz=01;31:_.bz2=01;31:_.bz=01;31:_.tbz=01;31:_.tbz2=01;31:_.tz=01;31:_.deb=01;31:_.rpm=01;31:_.jar=01;31:_.war=01;31:_.ear=01;31:_.sar=01;31:_.rar=01;31:_.ace=01;31:_.zoo=01;31:_.cpio=01;31:_.7z=01;31:_.rz=01;31:_.jpg=01;35:_.jpeg=01;35:_.gif=01;35:_.bmp=01;35:_.pbm=01;35:_.pgm=01;35:_.ppm=01;35:_.tga=01;35:_.xbm=01;35:_.xpm=01;35:_.tif=01;35:_.tiff=01;35:_.png=01;35:_.svg=01;35:_.svgz=01;35:_.mng=01;35:_.pcx=01;35:_.mov=01;35:_.mpg=01;35:_.mpeg=01;35:_.m2v=01;35:_.mkv=01;35:_.webm=01;35:_.ogm=01;35:_.mp4=01;35:_.m4v=01;35:_.mp4v=01;35:_.vob=01;35:_.qt=01;35:_.nuv=01;35:_.wmv=01;35:_.asf=01;35:_.rm=01;35:_.rmvb=01;35:_.flc=01;35:_.avi=01;35:_.fli=01;35:_.flv=01;35:_.gl=01;35:_.dl=01;35:_.xcf=01;35:_.xwd=01;35:_.yuv=01;35:_.cgm=01;35:_.emf=01;35:_.axv=01;35:_.anx=01;35:_.ogv=01;35:_.ogx=01;35:_.aac=00;36:_.au=00;36:_.flac=00;36:_.mid=00;36:_.midi=00;36:_.mka=00;36:_.mp3=00;36:_.mpc=00;36:_.ogg=00;36:_.ra=00;36:_.wav=00;36:_.axa=00;36:_.oga=00;36:_.spx=00;36:_.xspf=00;36: _SERVER["XAUTHORITY"] => /home/mido/.Xauthority _SERVER["SUDO_COMMAND"] => /usr/bin/make test _SERVER["SSH_AUTH_SOCK"] => deleted _SERVER["SHELL"] => /bin/bash _SERVER["SUDO_USER"] => mido _SERVER["PWD"] => /home/mido/Stažené/runkit-master _SERVER["SSH_CONNECTION"] => deleted _SERVER["CC"] => cc _SERVER["MFLAGS"] => _SERVER["PHP_SELF"] => _SERVER["SCRIPT_NAME"] => _SERVER["SCRIPT_FILENAME"] => _SERVER["PATH_TRANSLATED"] => _SERVER["DOCUMENT_ROOT"] => _SERVER["REQUEST_TIME_FLOAT"] => 1368989345.8511 _SERVER["REQUEST_TIME"] => 1368989345 _SERVER["argv"] => Array ( ) _SERVER["argc"] => 0 PHP License This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact [email protected].

runkit_method_copy does not copy doc_comment from original method

issue found in function php_runkit_method_add_or_update
to fix this issue I'm add code, listed below, after 435 line (which is: func.common.function_name = estrndup(methodname, methodname_len);):

ifdef ZEND_ENGINE_2

if (add_or_update == HASH_UPDATE) {
func.op_array.doc_comment = estrndup(orig_fe->op_array.doc_comment, orig_fe->op_array.doc_comment_len);
func.op_array.doc_comment_len = orig_fe->op_array.doc_comment_len;
}

endif

Also there is no way to create function with doc_comment

runkit does not compile against php 5.4

Trying to compile runkit against php 5.4RC5 on Macos Lion, I get the following error:

/Users/ash/git/runkit/runkit.c: In function 'php_runkit_register_auto_global':
/Users/ash/git/runkit/runkit.c:285: warning: passing argument 3 of 'zend_register_auto_global' makes integer from pointer without a cast
/Users/ash/git/runkit/runkit.c:285: error: too few arguments to function 'zend_register_auto_global'
/Users/ash/git/runkit/runkit.c: In function 'zm_deactivate_runkit':
/Users/ash/git/runkit/runkit.c:378: warning: passing argument 2 of 'zend_hash_apply' from incompatible pointer type
/Users/ash/git/runkit/runkit.c:388: warning: passing argument 2 of 'zend_hash_apply' from incompatible pointer type
/Users/ash/git/runkit/runkit.c:396: warning: passing argument 2 of 'zend_hash_apply_with_arguments' from incompatible pointer type
make: *** [runkit.lo] Error 1

Not sure what other infos I should include here, just ask and I'll provide!

Allowed memory size of 134217728 bytes exhausted (tried to allocate 1073741824 bytes)

Following code http://pastebin.com/E7NRedYw dies on line 82 with this error:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1073741824 bytes) in /home/paladin/CodeIgniter/tests/system/core/CommonTest.php on line 82
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:187
PHP 5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:325
PHP 6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705
PHP 7. PHPUnit_Framework_TestSuite->runTest() /usr/share/pear/PHPUnit/Framework/TestSuite.php:745
PHP 8. PHPUnit_Framework_TestCase->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:772
PHP 9. PHPUnit_Framework_TestResult->run() /usr/share/pear/PHPUnit/Framework/TestCase.php:749
PHP 10. PHPUnit_Framework_TestCase->runBare() /usr/share/pear/PHPUnit/Framework/TestResult.php:649
PHP 11. PHPUnit_Framework_TestCase->runTest() /usr/share/pear/PHPUnit/Framework/TestCase.php:802
PHP 12. ReflectionMethod->invokeArgs() /usr/share/pear/PHPUnit/Framework/TestCase.php:940
PHP 13. CommonTest->testLoad_class_basepath_prefix() /usr/share/pear/PHPUnit/Framework/TestCase.php:940
PHP 14. runkit_function_copy() /home/paladin/CodeIgniter/tests/system/core/CommonTest.php:82

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1073741824 bytes) in /home/paladin/CodeIgniter/tests/system/core/CommonTest.php on line 82

Call Stack:
0.0004 323516 1. {main}() /usr/bin/phpunit:0
0.3582 743372 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
0.3583 743860 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
0.9710 3648504 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:187
1.0501 3994156 5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:325
1.2415 4517656 6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705
1.2864 4541788 7. PHPUnit_Framework_TestSuite->runTest() /usr/share/pear/PHPUnit/Framework/TestSuite.php:745
1.2864 4541788 8. PHPUnit_Framework_TestCase->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:772
1.2867 4541788 9. PHPUnit_Framework_TestResult->run() /usr/share/pear/PHPUnit/Framework/TestCase.php:749
1.2868 4542660 10. PHPUnit_Framework_TestCase->runBare() /usr/share/pear/PHPUnit/Framework/TestResult.php:649
1.2885 4589248 11. PHPUnit_Framework_TestCase->runTest() /usr/share/pear/PHPUnit/Framework/TestCase.php:802
1.2886 4590352 12. ReflectionMethod->invokeArgs() /usr/share/pear/PHPUnit/Framework/TestCase.php:940
1.2886 4590380 13. CommonTest->testLoad_class_basepath_prefix() /usr/share/pear/PHPUnit/Framework/TestCase.php:940
1.2903 4597760 14. runkit_function_copy() /home/paladin/CodeIgniter/tests/system/core/CommonTest.php:82

Support for removing of a default property

Hello!

I wonder, if it would be possible to ask you to add support for removing a default property of a class (see the attached patch)? Be warned though: It's my first C code in 10+ years and know next to nothing of PHP internals, the patch should be properly reviewed and the issues fixed. :-P

-- Juhan Kundla

diff --git a/php_runkit.h b/php_runkit.h
index f919c68..b64bc96 100644
--- a/php_runkit.h
+++ b/php_runkit.h
@@ -99,6 +99,7 @@ PHP_FUNCTION(runkit_constant_redefine);
 PHP_FUNCTION(runkit_constant_remove);
 PHP_FUNCTION(runkit_constant_add);
 PHP_FUNCTION(runkit_default_property_add);
+PHP_FUNCTION(runkit_default_property_remove);
 PHP_FUNCTION(runkit_class_emancipate);
 PHP_FUNCTION(runkit_class_adopt);
 PHP_FUNCTION(runkit_import);
diff --git a/runkit.c b/runkit.c
index 0dfd32d..79c3a3a 100644
--- a/runkit.c
+++ b/runkit.c
@@ -113,6 +113,7 @@ zend_function_entry runkit_functions[] = {
    PHP_FE(runkit_constant_add,                                     NULL)

    PHP_FE(runkit_default_property_add,                             NULL)
+   PHP_FE(runkit_default_property_remove,                              NULL)
 #endif /* PHP_RUNKIT_MANIPULATION */

 #ifdef PHP_RUNKIT_SANDBOX
diff --git a/runkit_props.c b/runkit_props.c
index 54df0f1..1cdf16b 100644
--- a/runkit_props.c
+++ b/runkit_props.c
@@ -189,6 +189,73 @@ static int php_runkit_def_prop_add(char *classname, int classname_len, char *pro
 }
 /* }}} */

+
+/* {{{ php_runkit_prop_remove
+ */
+static int php_runkit_def_prop_remove(char *classname, int classname_len, char *propname, int propname_len)
+{
+   zend_class_entry *ce;
+   char *protected, *private, *key = 0;
+   int protected_len, private_len, key_len = 0;
+
+   if (php_runkit_fetch_class(classname, classname_len, &ce TSRMLS_CC) == FAILURE) {
+       return FAILURE;
+   }
+
+   if (ce->type != ZEND_USER_CLASS) {
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Removing properties from internal classes is not allowed");
+       return FAILURE;
+   }
+
+   /* Resolve the property's name */
+   if (zend_hash_exists(&ce->default_properties, propname, propname_len + 1)) {
+       key = propname;
+       key_len = propname_len;
+   }
+
+#ifdef ZEND_ENGINE_2
+   if (! key) {
+       zend_mangle_property_name(&protected, &protected_len, "*", 1, propname, propname_len, 0);
+       if (zend_hash_exists(&ce->default_properties, protected, protected_len + 1)) {
+           key = protected;
+           key_len = protected_len;
+       } else {
+           efree(protected);
+       }
+   }
+
+   if (! key) {
+       zend_mangle_property_name(&private, &private_len, classname, classname_len, propname, propname_len, 0);
+       if (zend_hash_exists(&ce->default_properties, private, private_len + 1)) {
+           key = private;
+           key_len = private_len;
+       } else {
+           efree(private);
+       }
+   }
+#endif
+
+   if (! key) {
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::%s does not exist", classname, propname);
+       return FAILURE;
+   }
+
+   if (zend_hash_del(&ce->default_properties, key, key_len + 1) == FAILURE) {
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to remove the property from class: %s::%s", classname, propname);
+       if (key != propname) {
+           efree(key);
+       }
+       return FAILURE;
+   }
+
+   if (key != propname) {
+       efree(key);
+   }
+   return SUCCESS;
+}
+/* }}} */
+
+
 /* ******************
    * Properties API *
    ****************** */
@@ -218,6 +285,26 @@ PHP_FUNCTION(runkit_default_property_add)
    RETURN_BOOL(php_runkit_def_prop_add(classname, classname_len, propname, propname_len, value, visibility TSRMLS_CC) == SUCCESS);
 }
 /* }}} */
+
+
+/* {{{ proto bool runkit_default_property_remove(string classname, string propname)
+Remove a property from a class
+ */
+PHP_FUNCTION(runkit_default_property_remove)
+{
+   char *classname, *propname;
+   int classname_len, propname_len;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s/s/", &classname, &classname_len, &propname, &propname_len) == FAILURE) {
+       RETURN_FALSE;
+   }
+
+   php_strtolower(classname, classname_len);
+   php_strtolower(propname, propname_len);
+
+   RETURN_BOOL(php_runkit_def_prop_remove(classname, classname_len, propname, propname_len) == SUCCESS);
+}
+/* }}} */
 #endif /* PHP_RUNKIT_MANIPULATION */

 /*

Build fails on CentOS 6.2 with php 5.3.10

Build fails for both master and 1.0.3 tag with following error:

...
/bin/sh /root/build/php-5.3.10/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/runkit/ -I/root/build/php-5.3.10/ext/runkit/ -DPHP_ATOM_INC -I/root/build/php-5.3.10/include -I/root/build/php-5.3.10/main -I/root/build/php-5.3.10 -I/root/build/php-5.3.10/ext/date/lib -I/root/build/php-5.3.10/ext/ereg/regex -I/usr/include/libxml2 -I/root/build/php-5.3.10/ext/mongo/util -I/root/build/php-5.3.10/ext/sqlite3/libsqlite -I/root/build/php-5.3.10/TSRM -I/root/build/php-5.3.10/Zend    -I/usr/include -g -O2 -fvisibility=hidden  -c /root/build/php-5.3.10/ext/runkit/runkit.c -o ext/runkit/runkit.lo 
In file included from /root/build/php-5.3.10/ext/runkit/runkit.c:22:
/root/build/php-5.3.10/ext/runkit/php_runkit.h:131: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'runkit_globals'
/root/build/php-5.3.10/ext/runkit/runkit.c:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'runkit_globals'
/root/build/php-5.3.10/ext/runkit/runkit.c:163: error: expected ')' before '*' token
/root/build/php-5.3.10/ext/runkit/runkit.c: In function 'zm_startup_runkit':
/root/build/php-5.3.10/ext/runkit/runkit.c:198: error: 'runkit_globals' undeclared (first use in this function)
/root/build/php-5.3.10/ext/runkit/runkit.c:198: error: (Each undeclared identifier is reported only once
/root/build/php-5.3.10/ext/runkit/runkit.c:198: error: for each function it appears in.)
make: *** [ext/runkit/runkit.lo] Error 1

Please advise.

Provide php_runkit.dll

Would it be possible to provide the compiled php_runkit.dll? I'm having a hard time creating it myself, and I don't find it anywhere for downloading.

Thanks, Adrian

Runkit Sandbox causes PHP-FPM to crash

I've got PHP-5.4.8 compiled with thread safety and FPM support, trying to run a sandbox within FPM.

When I run the following script inside PHP-FPM, I get a crash. The same script works fine on the command line. PHP-FPM is working great apart from using runkit sandbox.

            $options = array(
            'safe_mode'=>false,
            'open_basedir'=>'',
            'allow_url_fopen'=>'true',
            'disable_functions'=>'exec,shell_exec,passthru,system',
            'disable_classes'=>'myAppClass');
            
            $sandbox = new Runkit_Sandbox($options);
            $sandbox->eval('echo "hello from sandbox\n";');
            $hello = "hello world from parent";
            echo $hello;

Here's the stack trace of PHP-FPM in the core dump
#0 fcgi_finish_request (req=0x0, force_close=0)

at /home/tranelson/php-5.4.8/sapi/fpm/fpm/fastcgi.c:1040

#1 0x08440032 in sapi_cgi_deactivate (tsrm_ls=)

at /home/tranelson/php-5.4.8/sapi/fpm/fpm/fpm_main.c:843

#2 sapi_cgi_deactivate (tsrm_ls=0xa6adaf8)

at /home/tranelson/php-5.4.8/sapi/fpm/fpm/fpm_main.c:832

#3 0x0831eaf4 in sapi_deactivate (tsrm_ls=0xa6adaf8)

at /home/tranelson/php-5.4.8/main/SAPI.c:529

#4 0x08315f3c in php_request_shutdown (dummy=0xa6adaf8)

at /home/tranelson/php-5.4.8/main/main.c:1799

#5 0xb68241fb in php_runkit_sandbox_dtor (objval=0xb6a76548,

tsrm_ls=0xa51a070)
at /home/tranelson/runkit/runkit-master/runkit_sandbox.c:1838

#6 0x083ab42c in zend_objects_store_del_ref_by_handle_ex (handle=1,

handlers=0xb68307a0, tsrm_ls=0xa51a070)
at /home/tranelson/php-5.4.8/Zend/zend_objects_API.c:220

#7 0x083ab466 in zend_objects_store_del_ref (zobject=0xb6a7652c,

tsrm_ls=0xa51a070) at /home/tranelson/php-5.4.8/Zend/zend_objects_API.c:172

#8 0x08380581 in _zval_dtor_func (zvalue=0xb6a7652c)

at /home/tranelson/php-5.4.8/Zend/zend_variables.c:52

#9 0x08371768 in _zval_dtor (zvalue=)

at /home/tranelson/php-5.4.8/Zend/zend_variables.h:35

#10 _zval_ptr_dtor (zval_ptr=0xb6a766ec)

---Type to continue, or q to quit---
at /home/tranelson/php-5.4.8/Zend/zend_execute_API.c:438
#11 _zval_ptr_dtor (zval_ptr=0xb6a766ec)

at /home/tranelson/php-5.4.8/Zend/zend_execute_API.c:427

#12 0x0838f055 in zend_hash_apply_deleter (ht=0xa51bb88, p=0xb6a766e0)

at /home/tranelson/php-5.4.8/Zend/zend_hash.c:650

#13 0x083908e1 in zend_hash_reverse_apply (ht=0xa51bb88,

apply_func=0x8371590 <zval_call_destructor>, tsrm_ls=0xa51a070)
at /home/tranelson/php-5.4.8/Zend/zend_hash.c:804

#14 0x08371c1e in shutdown_destructors (tsrm_ls=0xa51a070)

at /home/tranelson/php-5.4.8/Zend/zend_execute_API.c:217

#15 0x08382098 in zend_call_destructors (tsrm_ls=0xa51a070)

at /home/tranelson/php-5.4.8/Zend/zend.c:922

#16 0x08315fc4 in php_request_shutdown (dummy=0x0)

at /home/tranelson/php-5.4.8/main/main.c:1732

#17 0x0806efc2 in main (argc=1, argv=0xbfac87a4)

at /home/tranelson/php-5.4.8/sapi/fpm/fpm/fpm_main.c:1948

Thanks
-Travis

undefined symbol: ZVAL_REFCOUNT

Repro steps:

  1. Install runkit using "pecl install http://github.com/downloads/zenovich/runkit/runkit-1.0.1.tgz"
  2. Add "extension=runkit.so" to php config
  3. run "php -v"

Result:

Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/runkit.so' - /usr/lib/php/modules/runkit.so: undefined symbol: ZVAL_REFCOUNT in Unknown on line 0
PHP 5.3.0 (cli) (built: Jul 19 2009 17:55:08)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Passing a callable to runkit_*_redefine?

Hey, this may be completely stupid, I'm not sure so if it is don't hesitate to tell me, but I though it'd be handy to be able to pass a callable to runkit_method_redefine and runkit_function_redefine instead of a string.

What do you think?

Does not work on PHP 5.4.14...

Get this error in the process, what should I do?

running: make
/bin/sh /root/tmp/pear/pear-build-root0i4zWf/runkit-1.0.3/libtool --mode=compile cc -I. -I/root/tmp/pear/runkit -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-root0i4zWf/runkit-1.0.3/include -I/root/tmp/pear/pear-build-root0i4zWf/runkit-1.0.3/main -I/root/tmp/pear/runkit -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/runkit/runkit.c -o runkit.lo
mkdir .libs
cc -I. -I/root/tmp/pear/runkit -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-root0i4zWf/runkit-1.0.3/include -I/root/tmp/pear/pear-build-root0i4zWf/runkit-1.0.3/main -I/root/tmp/pear/runkit -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/runkit/runkit.c -fPIC -DPIC -o .libs/runkit.o
/root/tmp/pear/runkit/runkit.c: In function ‘php_runkit_register_auto_global’:
/root/tmp/pear/runkit/runkit.c:285: warning: passing argument 3 of ‘zend_register_auto_global’ makes integer from pointer without a cast
/root/tmp/pear/runkit/runkit.c:285: error: too few arguments to function ‘zend_register_auto_global’
/root/tmp/pear/runkit/runkit.c: In function ‘zm_deactivate_runkit’:
/root/tmp/pear/runkit/runkit.c:378: warning: passing argument 2 of ‘zend_hash_apply’ from incompatible pointer type
/root/tmp/pear/runkit/runkit.c:388: warning: passing argument 2 of ‘zend_hash_apply’ from incompatible pointer type
/root/tmp/pear/runkit/runkit.c:396: warning: passing argument 2 of ‘zend_hash_apply_with_arguments’ from incompatible pointer type
make: *** [runkit.lo] Error 1
ERROR: `make' failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.