xref: /PHP-8.0/Zend/tests/bug33999.phpt (revision fb4554e4)
1--TEST--
2Bug #33999 (object remains object when cast to int)
3--INI--
4error_reporting=4095
5--FILE--
6<?php
7class Foo {
8  public $bar = "bat";
9}
10
11$foo = new Foo;
12var_dump($foo);
13
14$bar = (int)$foo;
15var_dump($bar);
16
17$baz = (float)$foo;
18var_dump($baz);
19?>
20--EXPECTF--
21object(Foo)#1 (1) {
22  ["bar"]=>
23  string(3) "bat"
24}
25
26Warning: Object of class Foo could not be converted to int in %s on line %d
27int(1)
28
29Warning: Object of class Foo could not be converted to float in %s on line %d
30float(1)
31