From a3a797dbd56a5b9f71eb2b5c82a5722314642640 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sun, 24 Jul 2016 11:01:19 +0800 Subject: [PATCH] Fixed bug #72661 (ReflectionType::__toString crashes with iterable) --- NEWS | 4 ++++ ext/reflection/php_reflection.c | 1 + ext/reflection/tests/bug72661.phpt | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 ext/reflection/tests/bug72661.phpt diff --git a/NEWS b/NEWS index c9cce02259..b0deb13608 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ PHP NEWS . Fixed bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property). (Laruence) +- Reflection: + . Fixed bug #72661 (ReflectionType::__toString crashes with iterable). + (Laruence) + - SPL: . Fixed bug #72646 (SplFileObject::getCsvControl does not return the escape character). (cmb) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 0c9a8dbed1..ef04ecdb98 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3025,6 +3025,7 @@ ZEND_METHOD(reflection_type, __toString) case IS_LONG: RETURN_STRINGL("int", sizeof("int") - 1); case IS_DOUBLE: RETURN_STRINGL("float", sizeof("float") - 1); case IS_VOID: RETURN_STRINGL("void", sizeof("void") - 1); + case IS_ITERABLE: RETURN_STRINGL("iterable", sizeof("iterable") - 1); EMPTY_SWITCH_DEFAULT_CASE() } } diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt new file mode 100644 index 0000000000..40d14922b8 --- /dev/null +++ b/ext/reflection/tests/bug72661.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #72661 (ReflectionType::__toString crashes with iterable) +--FILE-- +getType()); +?> +--EXPECT-- +string(8) "iterable" -- 2.40.0