]> granicus.if.org Git - php/commitdiff
Fixed bug #72661 (ReflectionType::__toString crashes with iterable)
authorXinchen Hui <laruence@gmail.com>
Sun, 24 Jul 2016 03:01:19 +0000 (11:01 +0800)
committerXinchen Hui <laruence@gmail.com>
Sun, 24 Jul 2016 03:01:19 +0000 (11:01 +0800)
NEWS
ext/reflection/php_reflection.c
ext/reflection/tests/bug72661.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index c9cce02259b51be7b56368ef88e5fd23a89943ed..b0deb136083ca844021f2cd544da222bb2b10c4c 100644 (file)
--- 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)
index 0c9a8dbed1f8744fa5cad171547a29cf6bd0bd74..ef04ecdb98589f0690abc65e195f0c391448435c 100644 (file)
@@ -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 (file)
index 0000000..40d1492
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+Bug #72661 (ReflectionType::__toString crashes with iterable)
+--FILE--
+<?php
+function test(iterable $arg) { } 
+
+var_dump((string)(new ReflectionParameter("test", 0))->getType());
+?>
+--EXPECT--
+string(8) "iterable"