xref: /PHP-7.4/ext/simplexml/tests/bug62328.phpt (revision cb41a7ba)
1--TEST--
2Bug #62328 (implementing __toString and a cast to string fails)
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
5--FILE--
6<?php
7class UberSimpleXML extends SimpleXMLElement {
8    public function __toString() {
9        return 'stringification';
10    }
11}
12
13$xml = new UberSimpleXML('<xml/>');
14
15var_dump((string) $xml);
16var_dump($xml->__toString());
17--EXPECT--
18string(15) "stringification"
19string(15) "stringification"
20