xref: /PHP-8.3/Zend/tests/assert/bug70528.phpt (revision 3d4ff5ae)
1--TEST--
2Bug #70528 (assert() with instanceof adds apostrophes around class name)
3--INI--
4zend.assertions=1
5--FILE--
6<?php
7
8namespace Foo;
9class Bar {}
10
11$bar = "Bar";
12try {
13    assert(new \stdClass instanceof $bar);
14} catch (\AssertionError $e) {
15    echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
16}
17try {
18    assert(new \stdClass instanceof Bar);
19} catch (\AssertionError $e) {
20    echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
21}
22try {
23    assert(new \stdClass instanceof \Foo\Bar);
24} catch (\AssertionError $e) {
25    echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
26}
27?>
28--EXPECT--
29assert(): assert(new \stdClass() instanceof $bar) failed
30assert(): assert(new \stdClass() instanceof Bar) failed
31assert(): assert(new \stdClass() instanceof \Foo\Bar) failed
32