mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed bug #65291 - get_defined_constants() crash with __CLASS__ in trait
This commit is contained in:
parent
2b9d42433f
commit
a015fa83a7
2
NEWS
2
NEWS
@ -4,6 +4,8 @@ PHP NEWS
|
||||
|
||||
- Core.
|
||||
. Improve fix for bug #63186 (compile failure on netbsd). (Matteo)
|
||||
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
|
||||
limited case). (Arpad)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
|
||||
|
24
Zend/tests/bug65291.phpt
Normal file
24
Zend/tests/bug65291.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case.
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait TestTrait
|
||||
{
|
||||
public static function testStaticFunction()
|
||||
{
|
||||
return __CLASS__;
|
||||
}
|
||||
}
|
||||
class Tester
|
||||
{
|
||||
use TestTrait;
|
||||
}
|
||||
|
||||
$foo = Tester::testStaticFunction();
|
||||
get_defined_constants();
|
||||
|
||||
echo $foo;
|
||||
?>
|
||||
--EXPECT--
|
||||
Tester
|
@ -1926,6 +1926,11 @@ static int add_constant_info(zend_constant *constant, void *arg TSRMLS_DC)
|
||||
zval *name_array = (zval *)arg;
|
||||
zval *const_val;
|
||||
|
||||
if (!constant->name) {
|
||||
/* skip special constants */
|
||||
return 0;
|
||||
}
|
||||
|
||||
MAKE_STD_ZVAL(const_val);
|
||||
*const_val = constant->value;
|
||||
zval_copy_ctor(const_val);
|
||||
|
Loading…
Reference in New Issue
Block a user