xref: /PHP-8.1/ext/simplexml/tests/bug62328.phpt (revision 7f2f0c00)
1--TEST--
2Bug #62328 (implementing __toString and a cast to string fails)
3--EXTENSIONS--
4simplexml
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?>
18--EXPECT--
19string(15) "stringification"
20string(15) "stringification"
21