--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns ZERO (float)
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(0.0);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-0.0.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns ZERO
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(0);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-0.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns ONE (float)
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(1.0);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-1.0.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns ONE
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(1);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-1.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns EMPTY STRING
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C("");
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-empty_str.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns FALSE
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(false);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-false.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns OBJECT
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(new stdClass);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-object.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns RESOURCE
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(fopen("data:text/plain,Foo", 'r'));
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-resource.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns STRING
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C("foo");
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-str.php on line %d
--- /dev/null
+--TEST--
+Testing __debugInfo() magic method with bad returns TRUE
+--FILE--
+<?php
+
+class C {
+ public $val;
+ public function __debugInfo() {
+ return $this->val;
+ }
+ public function __construct($val) {
+ $this->val = $val;
+ }
+}
+
+$c = new C(true);
+var_dump($c);
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %s/Zend/tests/debug_info-error-true.php on line %d
}
}
+class Bar {
+ public $val = 123;
+
+ public function __debugInfo() {
+ return null;
+ }
+}
+
$f = new Foo;
var_dump($f);
---EXPECT--
-object(Foo)#1 (3) {
+
+$b = new Bar;
+var_dump($b);
+--EXPECTF--
+object(Foo)#%d (3) {
["a"]=>
int(1)
["b":protected]=>
["c":"Foo":private]=>
int(3)
}
+object(Bar)#%d (0) {
+}
zval ret;
array_init(&ret);
*is_temp = 1;
+ zval_ptr_dtor(&retval);
return Z_ARRVAL(ret);
}