From: bekkers at gmail dot com
Operating system: Windows
PHP version: 5.0.1
PHP Bug Type: Zend Engine 2 problem
Bug description: Apache crash when using
ReflectionFunction::getStaticVariables()
Description:
------------
The problem is that ZEND_METHOD(reflection_function, getStaticVariables)
in zend_reflection_api.c does not check wether the function is userdefined
or not. Wich apperently makes Apache crash.
I figured the function should look something like this:
/* {{{ proto public array ReflectionFunction::getStaticVariables()
Returns an associative array containing this function's static
variables and their values */
ZEND_METHOD(reflection_function, getStaticVariables)
{
zval *tmp_copy;
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
/* Return an empty array in case no static variables exist */
array_init(return_value);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables
!= NULL) {
zend_hash_copy(Z_ARRVAL_P(return_value),
fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *)
&tmp_copy, sizeof(zval *));
}
}
But I'm not shure and as I haven't (and can't) test it.
Reproduce code:
---------------
<?php
$R = new ReflectionFunction('phpversion');
$R->getStaticVariables();
?>
Expected result:
----------------
The output should be nothing. (Getting the static variables from a C
function does not sound logical)
Actual result:
--------------
Apache crashes
--
Edit bug report at http://bugs.php.net/?id=30783&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30783&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=30783&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=30783&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30783&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30783&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30783&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30783&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30783&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30783&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30783&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=30783&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=30783&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30783&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30783&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30783&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30783&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30783&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30783&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30783&r=mysqlcfg