Skip to content

Commit d0f4ec4

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 8c92744 + d891b5f commit d0f4ec4

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

EXTENSIONS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ STATUS: Working
330330
EXTENSION: gmp
331331
PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2000 - 2019)
332332
Antony Dovgal <tony2001@php.net> (2005 - 2010)
333+
Nikita Popov <nikic@php.net> (2013 - 2019)
333334
MAINTENANCE: Maintained
334335
STATUS: Working
335336
SINCE: 4.0.4
@@ -378,12 +379,14 @@ STATUS: Working
378379
-------------------------------------------------------------------------------
379380
EXTENSION: mbstring
380381
PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net> (2001 - 2013)
382+
Nikita Popov <nikic@php.net> (2017 - 2019)
381383
MAINTENANCE: Maintained
382384
STATUS: Working
383385
-------------------------------------------------------------------------------
384386
EXTENSION: opcache
385387
PRIMARY MAINTAINER: Dmitry Stogov <dmitry@php.net> (2013 - 2018)
386388
Xinchen Hui <laruence@php.net> (2013 - 2018)
389+
Nikita Popov <nikic@php.net> (2016 - 2019)
387390
MAINTENANCE: Maintained
388391
STATUS: Working
389392
SINCE: 5.5.0
@@ -500,7 +503,8 @@ STATUS: Working
500503
-------------------------------------------------------------------------------
501504
EXTENSION: tokenizer
502505
PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net> (2002 - 2002)
503-
MAINTENANCE: Unknown
506+
Nikita Popov <nikic@php.net> (2013 - 2019)
507+
MAINTENANCE: Maintained
504508
STATUS: Working
505509
-------------------------------------------------------------------------------
506510
EXTENSION: zip

ext/reflection/php_reflection.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4583,7 +4583,7 @@ ZEND_METHOD(reflection_class, isInstance)
45834583
}
45844584
/* }}} */
45854585

4586-
/* {{{ proto public stdclass ReflectionClass::newInstance([mixed* args], ...)
4586+
/* {{{ proto public object ReflectionClass::newInstance([mixed* args], ...)
45874587
Returns an instance of this class */
45884588
ZEND_METHOD(reflection_class, newInstance)
45894589
{
@@ -4657,7 +4657,7 @@ ZEND_METHOD(reflection_class, newInstance)
46574657
}
46584658
/* }}} */
46594659

4660-
/* {{{ proto public stdclass ReflectionClass::newInstanceWithoutConstructor()
4660+
/* {{{ proto public object ReflectionClass::newInstanceWithoutConstructor()
46614661
Returns an instance of this class without invoking its constructor */
46624662
ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
46634663
{
@@ -4666,7 +4666,8 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
46664666

46674667
GET_REFLECTION_OBJECT_PTR(ce);
46684668

4669-
if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL) {
4669+
if (ce->type == ZEND_INTERNAL_CLASS
4670+
&& ce->create_object != NULL && (ce->ce_flags & ZEND_ACC_FINAL)) {
46704671
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name));
46714672
return;
46724673
}
@@ -4675,7 +4676,7 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
46754676
}
46764677
/* }}} */
46774678

4678-
/* {{{ proto public stdclass ReflectionClass::newInstanceArgs([array args])
4679+
/* {{{ proto public object ReflectionClass::newInstanceArgs([array args])
46794680
Returns an instance of this class */
46804681
ZEND_METHOD(reflection_class, newInstanceArgs)
46814682
{

ext/reflection/tests/ReflectionClass_newInstanceWithoutConstructor.phpt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,29 @@ $class = new ReflectionClass('DateTime');
2222
var_dump($class->newInstanceWithoutConstructor());
2323

2424
$class = new ReflectionClass('Generator');
25+
try {
26+
var_dump($class->newInstanceWithoutConstructor());
27+
} catch (ReflectionException $e) {
28+
echo $e->getMessage(), "\n";
29+
}
30+
31+
final class Bar extends ArrayObject {
32+
}
33+
34+
$class = new ReflectionClass('Bar');
2535
var_dump($class->newInstanceWithoutConstructor());
36+
37+
?>
2638
--EXPECTF--
2739
object(Foo)#%d (0) {
2840
}
2941
object(stdClass)#%d (0) {
3042
}
3143
object(DateTime)#%d (0) {
3244
}
33-
34-
Fatal error: Uncaught ReflectionException: Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor in %sReflectionClass_newInstanceWithoutConstructor.php:%d
35-
Stack trace:
36-
#0 %sReflectionClass_newInstanceWithoutConstructor.php(%d): ReflectionClass->newInstanceWithoutConstructor()
37-
#1 {main}
38-
thrown in %sReflectionClass_newInstanceWithoutConstructor.php on line %d
45+
Class Generator is an internal class marked as final that cannot be instantiated without invoking its constructor
46+
object(Bar)#%d (1) {
47+
["storage":"ArrayObject":private]=>
48+
array(0) {
49+
}
50+
}

0 commit comments

Comments
 (0)