[php-src] master: Reflection: Add regression tests for error messages with null bytes

From: Date: Mon, 03 Aug 2026 17:47:18 +0000
Subject: [php-src] master: Reflection: Add regression tests for error messages with null bytes
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140440@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-08-03T08:43:31-07:00 Commit: https://github.com/php/php-src/commit/14b6cd3636abaa8031080efd2f71953c8d892477 Raw diff: https://github.com/php/php-src/commit/14b6cd3636abaa8031080efd2f71953c8d892477.diff Reflection: Add regression tests for error messages with null bytes So that when the outputs are fixed the changes can be confirmed in tests Changed paths: A ext/reflection/tests/gh22905/ReflectionClassConstant_construct_class.phpt A ext/reflection/tests/gh22905/ReflectionClassConstant_construct_constant.phpt A ext/reflection/tests/gh22905/ReflectionClass_construct.phpt A ext/reflection/tests/gh22905/ReflectionClass_getMethod.phpt A ext/reflection/tests/gh22905/ReflectionClass_getProperty.phpt A ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_base.phpt A ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_nobase.phpt A ext/reflection/tests/gh22905/ReflectionClass_getStaticPropertyValue.phpt A ext/reflection/tests/gh22905/ReflectionClass_implementsInterface.phpt A ext/reflection/tests/gh22905/ReflectionClass_isSubclassOf.phpt A ext/reflection/tests/gh22905/ReflectionClass_setStaticPropertyValue.phpt A ext/reflection/tests/gh22905/ReflectionConstant_construct.phpt A ext/reflection/tests/gh22905/ReflectionEnum_getCase.phpt A ext/reflection/tests/gh22905/ReflectionExtension_construct.phpt A ext/reflection/tests/gh22905/ReflectionFunction_construct.phpt A ext/reflection/tests/gh22905/ReflectionMethod_construct_class.phpt A ext/reflection/tests/gh22905/ReflectionMethod_construct_method.phpt A ext/reflection/tests/gh22905/ReflectionMethod_create_method.phpt A ext/reflection/tests/gh22905/ReflectionParameter_construct_class.phpt A ext/reflection/tests/gh22905/ReflectionParameter_construct_method.phpt A ext/reflection/tests/gh22905/ReflectionParameter_construct_string.phpt A ext/reflection/tests/gh22905/ReflectionProperty_construct_class.phpt A ext/reflection/tests/gh22905/ReflectionProperty_construct_property.phpt A ext/reflection/tests/gh22905/ReflectionProperty_setRawValueWithoutLazyInitialization.phpt A ext/reflection/tests/gh22905/ReflectionProperty_skipLazyInitialization.phpt A ext/reflection/tests/gh22905/ReflectionZendExtension_construct.phpt A ext/reflection/tests/gh22905/Reflection_getAttributes.phpt Diff: diff --git a/ext/reflection/tests/gh22905/ReflectionClassConstant_construct_class.phpt b/ext/reflection/tests/gh22905/ReflectionClassConstant_construct_class.phpt new file mode 100644 index 000000000000..296631022b45 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClassConstant_construct_class.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionClassConstant::__construct() error messages (class name) +--FILE-- +<?php + +new ReflectionClassConstant("foo\0bar", ""); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClassConstant->__construct('foo\x00bar', '') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClassConstant_construct_constant.phpt b/ext/reflection/tests/gh22905/ReflectionClassConstant_construct_constant.phpt new file mode 100644 index 000000000000..80234fccd93f --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClassConstant_construct_constant.phpt @@ -0,0 +1,15 @@ +--TEST-- +GH-22905: null bytes in ReflectionClassConstant::__construct() error messages (constant name) +--FILE-- +<?php + +class Demo {} +new ReflectionClassConstant(Demo::class, "foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Constant Demo::foo does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClassConstant->__construct('Demo', 'foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_construct.phpt b/ext/reflection/tests/gh22905/ReflectionClass_construct.phpt new file mode 100644 index 000000000000..2f162799f4a6 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_construct.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::__construct() error messages +--FILE-- +<?php + +new ReflectionClass("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->__construct('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_getMethod.phpt b/ext/reflection/tests/gh22905/ReflectionClass_getMethod.phpt new file mode 100644 index 000000000000..bcf14c75ed6f --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_getMethod.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::getMethod() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->getMethod("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Method Demo::foo() does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->getMethod('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_getProperty.phpt b/ext/reflection/tests/gh22905/ReflectionClass_getProperty.phpt new file mode 100644 index 000000000000..c837ccce40fe --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_getProperty.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::getProperty() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->getProperty("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Property Demo::$foo does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->getProperty('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_base.phpt b/ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_base.phpt new file mode 100644 index 000000000000..9b44817d76d5 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_base.phpt @@ -0,0 +1,17 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::getProperty() (fully qualified, base class) error messages +--FILE-- +<?php + +class Base {} +class Demo extends Base {} +$r = new ReflectionClass(Demo::class); +$r->getProperty("Base::foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Property Base::$foo does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->getProperty('Base::foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_nobase.phpt b/ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_nobase.phpt new file mode 100644 index 000000000000..324d9c01bb0e --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_getProperty_qualified_nobase.phpt @@ -0,0 +1,17 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::getProperty() (fully qualified, non-base class) error messages +--FILE-- +<?php + +class Base {} +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->getProperty("Base::foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Fully qualified property name Base::$foo does not specify a base class of Demo in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->getProperty('Base::foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_getStaticPropertyValue.phpt b/ext/reflection/tests/gh22905/ReflectionClass_getStaticPropertyValue.phpt new file mode 100644 index 000000000000..4e15eea234c7 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_getStaticPropertyValue.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::getStaticPropertyValue() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->getStaticPropertyValue("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Property Demo::$foo does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->getStaticPropertyValue('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_implementsInterface.phpt b/ext/reflection/tests/gh22905/ReflectionClass_implementsInterface.phpt new file mode 100644 index 000000000000..cfd02e450669 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_implementsInterface.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::implementsInterface() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->implementsInterface("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Interface "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->implementsInterface('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_isSubclassOf.phpt b/ext/reflection/tests/gh22905/ReflectionClass_isSubclassOf.phpt new file mode 100644 index 000000000000..19323edc8683 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_isSubclassOf.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::isSubclassOf() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->isSubclassOf("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->isSubclassOf('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionClass_setStaticPropertyValue.phpt b/ext/reflection/tests/gh22905/ReflectionClass_setStaticPropertyValue.phpt new file mode 100644 index 000000000000..fe074ebea6fd --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionClass_setStaticPropertyValue.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionClass::setStaticPropertyValue() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->setStaticPropertyValue("foo\0bar", 123); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class Demo does not have a property named foo in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->setStaticPropertyValue('foo\x00bar', 123) +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionConstant_construct.phpt b/ext/reflection/tests/gh22905/ReflectionConstant_construct.phpt new file mode 100644 index 000000000000..c5ad649e5dec --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionConstant_construct.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionConstant::__construct() error messages +--FILE-- +<?php + +new ReflectionConstant("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Constant "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionConstant->__construct('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionEnum_getCase.phpt b/ext/reflection/tests/gh22905/ReflectionEnum_getCase.phpt new file mode 100644 index 000000000000..b73afaff1e98 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionEnum_getCase.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionEnum::getCase() error messages +--FILE-- +<?php + +enum Demo {} +$r = new ReflectionEnum(Demo::class); +$r->getCase("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Case Demo::foo does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionEnum->getCase('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionExtension_construct.phpt b/ext/reflection/tests/gh22905/ReflectionExtension_construct.phpt new file mode 100644 index 000000000000..29ec0fc9ec0b --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionExtension_construct.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionExtension::__construct() error messages +--FILE-- +<?php + +new ReflectionExtension("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Extension "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionExtension->__construct('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionFunction_construct.phpt b/ext/reflection/tests/gh22905/ReflectionFunction_construct.phpt new file mode 100644 index 000000000000..a1f55c49fb2e --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionFunction_construct.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionFunction::__construct() error messages +--FILE-- +<?php + +new ReflectionFunction("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Function foo() does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionFunction->__construct('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionMethod_construct_class.phpt b/ext/reflection/tests/gh22905/ReflectionMethod_construct_class.phpt new file mode 100644 index 000000000000..25fb2a39a708 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionMethod_construct_class.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionMethod::__construct() error messages (class name) +--FILE-- +<?php + +new ReflectionMethod("foo\0bar", ""); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionMethod->__construct('foo\x00bar', '') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionMethod_construct_method.phpt b/ext/reflection/tests/gh22905/ReflectionMethod_construct_method.phpt new file mode 100644 index 000000000000..2cff25bf8b09 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionMethod_construct_method.phpt @@ -0,0 +1,15 @@ +--TEST-- +GH-22905: null bytes in ReflectionMethod::__construct() error messages (method name) +--FILE-- +<?php + +class Demo {} +new ReflectionMethod(Demo::class, "foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Method Demo::foo() does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionMethod->__construct('Demo', 'foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionMethod_create_method.phpt b/ext/reflection/tests/gh22905/ReflectionMethod_create_method.phpt new file mode 100644 index 000000000000..483ecaa4637a --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionMethod_create_method.phpt @@ -0,0 +1,15 @@ +--TEST-- +GH-22905: null bytes in ReflectionMethod::createFromMethodName() error messages (method name) +--FILE-- +<?php + +class Demo {} +ReflectionMethod::createFromMethodName("Demo::foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Method Demo::foo() does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionMethod::createFromMethodName('Demo::foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionParameter_construct_class.phpt b/ext/reflection/tests/gh22905/ReflectionParameter_construct_class.phpt new file mode 100644 index 000000000000..9c993459b259 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionParameter_construct_class.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionParameter::__construct() error messages (array class name) +--FILE-- +<?php + +new ReflectionParameter(["foo\0bar", ""], 0); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionParameter->__construct(Array, 0) +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionParameter_construct_method.phpt b/ext/reflection/tests/gh22905/ReflectionParameter_construct_method.phpt new file mode 100644 index 000000000000..4add442d8db5 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionParameter_construct_method.phpt @@ -0,0 +1,15 @@ +--TEST-- +GH-22905: null bytes in ReflectionParameter::__construct() error messages (array method name) +--FILE-- +<?php + +class Demo {} +new ReflectionParameter([Demo::class, "foo\0bar"], 0); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Method Demo::foo() does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionParameter->__construct(Array, 0) +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionParameter_construct_string.phpt b/ext/reflection/tests/gh22905/ReflectionParameter_construct_string.phpt new file mode 100644 index 000000000000..4bf349b4f158 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionParameter_construct_string.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionParameter::__construct() error messages (string function) +--FILE-- +<?php + +new ReflectionParameter("foo\0bar", 0); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Function foo() does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionParameter->__construct('foo\x00bar', 0) +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionProperty_construct_class.phpt b/ext/reflection/tests/gh22905/ReflectionProperty_construct_class.phpt new file mode 100644 index 000000000000..25048c0e2b6a --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionProperty_construct_class.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionProperty::__construct() error messages (class name) +--FILE-- +<?php + +new ReflectionProperty("foo\0bar", ""); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Class "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionProperty->__construct('foo\x00bar', '') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionProperty_construct_property.phpt b/ext/reflection/tests/gh22905/ReflectionProperty_construct_property.phpt new file mode 100644 index 000000000000..460d8e86f9e7 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionProperty_construct_property.phpt @@ -0,0 +1,15 @@ +--TEST-- +GH-22905: null bytes in ReflectionProperty::__construct() error messages (property name) +--FILE-- +<?php + +class Demo {} +new ReflectionProperty(Demo::class, "foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Property Demo::$foo does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionProperty->__construct('Demo', 'foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionProperty_setRawValueWithoutLazyInitialization.phpt b/ext/reflection/tests/gh22905/ReflectionProperty_setRawValueWithoutLazyInitialization.phpt new file mode 100644 index 000000000000..371ebddcd2f5 --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionProperty_setRawValueWithoutLazyInitialization.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionProperty::setRawValueWithoutLazyInitialization() error messages +--FILE-- +<?php + +$o = (object)["foo\0bar" => "baz"]; +$r = new ReflectionProperty($o, "foo\0bar"); +$r->setRawValueWithoutLazyInitialization($o, 123); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Can not use setRawValueWithoutLazyInitialization on dynamic property stdClass::$foo in %s:%d +Stack trace: +#0 %s(%d): ReflectionProperty->setRawValueWithoutLazyInitialization(Object(stdClass), 123) +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionProperty_skipLazyInitialization.phpt b/ext/reflection/tests/gh22905/ReflectionProperty_skipLazyInitialization.phpt new file mode 100644 index 000000000000..5a8279adea5f --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionProperty_skipLazyInitialization.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in ReflectionProperty::skipLazyInitialization() error messages +--FILE-- +<?php + +$o = (object)["foo\0bar" => "baz"]; +$r = new ReflectionProperty($o, "foo\0bar"); +$r->skipLazyInitialization($o); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Can not use skipLazyInitialization on dynamic property stdClass::$foo in %s:%d +Stack trace: +#0 %s(%d): ReflectionProperty->skipLazyInitialization(Object(stdClass)) +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/ReflectionZendExtension_construct.phpt b/ext/reflection/tests/gh22905/ReflectionZendExtension_construct.phpt new file mode 100644 index 000000000000..1376e26386ee --- /dev/null +++ b/ext/reflection/tests/gh22905/ReflectionZendExtension_construct.phpt @@ -0,0 +1,14 @@ +--TEST-- +GH-22905: null bytes in ReflectionZendExtension::__construct() error messages +--FILE-- +<?php + +new ReflectionZendExtension("foo\0bar"); + +?> +--EXPECTF-- +Fatal error: Uncaught ReflectionException: Zend Extension "foo" does not exist in %s:%d +Stack trace: +#0 %s(%d): ReflectionZendExtension->__construct('foo\x00bar') +#1 {main} + thrown in %s on line %d diff --git a/ext/reflection/tests/gh22905/Reflection_getAttributes.phpt b/ext/reflection/tests/gh22905/Reflection_getAttributes.phpt new file mode 100644 index 000000000000..3df8781ac669 --- /dev/null +++ b/ext/reflection/tests/gh22905/Reflection_getAttributes.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-22905: null bytes in Reflection*::getAttributes() error messages +--FILE-- +<?php + +class Demo {} +$r = new ReflectionClass(Demo::class); +$r->getAttributes("foo\0bar", ReflectionAttribute::IS_INSTANCEOF); + +?> +--EXPECTF-- +Fatal error: Uncaught Error: Class "foo" not found in %s:%d +Stack trace: +#0 %s(%d): ReflectionClass->getAttributes('foo\x00bar', 2) +#1 {main} + thrown in %s on line %d

« previous php.cvs (#140440) next »