Download src/php/php-src/ext/simplexml/tests/012.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 754 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/simplexml/tests/012.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/simplexml/tests/012.phpt
-
curl -L -o 012.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/simplexml/tests/012.phpt
754 Bytes
| --TEST-- | |
| SimpleXML: Attribute creation | |
| --EXTENSIONS-- | |
| simplexml | |
| --FILE-- | |
| $xml =<<<EOF | |
| <?xml version="1.0" encoding="ISO-8859-1" ?> | |
| <foo/> | |
| EOF; | |
| $sxe = simplexml_load_string($xml); | |
| try { | |
| $sxe[""] = "value"; | |
| } catch (ValueError $exception) { | |
| echo $exception->getMessage() . "\n"; | |
| } | |
| $sxe["attr"] = "value"; | |
| echo $sxe->asXML(); | |
| $sxe["attr"] = "new value"; | |
| echo $sxe->asXML(); | |
| try { | |
| $sxe[] = "error"; | |
| } catch (ValueError $exception) { | |
| echo $exception->getMessage() . "\n"; | |
| } | |
| __HALT_COMPILER(); | |
| ===DONE=== | |
| --EXPECT-- | |
| Cannot create attribute with an empty name | |
| xml version="1.0" encoding="ISO-8859-1" | |
| <foo attr="value"/> | |
| xml version="1.0" encoding="ISO-8859-1" | |
| <foo attr="new value"/> | |
| Cannot append to an attribute list | |