summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-07-17 18:50:56 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-07-17 18:50:56 +0000
commit02c55f6c63acf31beff6d0c4b6a6aa8bf7a1ca84 (patch)
treeea086531be12b00a478bc1232726847ebae9fcf1 /tests
parentd462d938369f9590b7e58f535d3b3386ffe11101 (diff)
downloadphp-git-02c55f6c63acf31beff6d0c4b6a6aa8bf7a1ca84.tar.gz
Added test case for bug #24658
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/bug24658.phpt47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt
new file mode 100644
index 0000000000..ff4d7caba3
--- /dev/null
+++ b/tests/lang/bug24658.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Bug #24658 (combo of typehint / reference causes crash)
+--FILE--
+<?php
+class foo {}
+function no_typehint($a) {
+ var_dump($a);
+}
+function typehint(foo $a) {
+ var_dump($a);
+}
+function no_typehint_ref(&$a) {
+ var_dump($a);
+}
+function typehint_ref(foo &$a) {
+ var_dump($a);
+}
+$v = new foo();
+$a = array(new foo(), 1, 2);
+no_typehint($v);
+typehint($v);
+no_typehint_ref($v);
+typehint_ref($v);
+array_walk($a, 'no_typehint');
+array_walk($a, 'no_typehint_ref');
+array_walk($a, 'typehint');
+array_walk($a, 'typehint_ref');
+?>
+--EXPECTF--
+object(foo)#%d (0) {
+}
+object(foo)#%d (0) {
+}
+object(foo)#%d (0) {
+}
+object(foo)#%d (0) {
+}
+object(foo)#%d (0) {
+}
+int(1)
+int(2)
+object(foo)#%d (0) {
+}
+int(1)
+int(2)
+
+Fatal error: Argument 1 must be an instance of foo in %s on line %d