]> granicus.if.org Git - php/commitdiff
Add tests with invalid Error construction params
authorAaron Piotrowski <aaron@trowski.com>
Thu, 18 Jun 2015 00:49:02 +0000 (19:49 -0500)
committerAaron Piotrowski <aaron@trowski.com>
Thu, 18 Jun 2015 00:49:02 +0000 (19:49 -0500)
Zend/tests/exception_021.phpt [new file with mode: 0644]
Zend/tests/exception_022.phpt [new file with mode: 0644]

diff --git a/Zend/tests/exception_021.phpt b/Zend/tests/exception_021.phpt
new file mode 100644 (file)
index 0000000..5955e79
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Testing throw exception doesn't crash with wrong params, variant 3
+--FILE--
+<?php
+
+class Hello extends Error {}
+throw new Hello(new stdClass);
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Wrong parameters for Hello([string $message [, long $code [, Throwable $previous = NULL]]]) in %sexception_021.php:%d
+Stack trace:
+#0 %sexception_021.php(%d): Error->__construct(Object(stdClass))
+#1 {main}
+  thrown in %sexception_021.php on line %d
diff --git a/Zend/tests/exception_022.phpt b/Zend/tests/exception_022.phpt
new file mode 100644 (file)
index 0000000..83d4714
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Testing throw exception doesn't crash with wrong params, variant 4
+--FILE--
+<?php
+
+throw new Error(new stdClass);
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Wrong parameters for Error([string $message [, long $code [, Throwable $previous = NULL]]]) in %sexception_022.php:%d
+Stack trace:
+#0 %sexception_022.php(%d): Error->__construct(Object(stdClass))
+#1 {main}
+  thrown in %sexception_022.php on line %d