xref: /PHP-7.2/Zend/tests/bug30791.phpt (revision 610c7fbe)
1--TEST--
2Bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call if object is overloaded)
3--FILE--
4<?php
5
6function my_error_handler($errno, $errstr, $errfile, $errline) {
7	var_dump($errstr);
8}
9
10set_error_handler('my_error_handler');
11
12class a
13{
14   public $a = 4;
15   function __call($a,$b) {
16       return "unknown method";
17   }
18}
19
20$b = new a;
21echo $b,"\n";
22$c = unserialize(serialize($b));
23echo $c,"\n";
24var_dump($c);
25
26?>
27--EXPECT--
28string(50) "Object of class a could not be converted to string"
29
30string(50) "Object of class a could not be converted to string"
31
32object(a)#2 (1) {
33  ["a"]=>
34  int(4)
35}
36