Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- xmlwriter_start/end_attribute() --EXTENSIONS-- xmlwriter --FILE-- <?php $file = ..
Decoded Output download
--TEST--
xmlwriter_start/end_attribute()
--EXTENSIONS--
xmlwriter
--FILE--
<?php
$file = __DIR__.'/010.tmp';
$xw = xmlwriter_open_uri($file);
var_dump(xmlwriter_start_element($xw, "tag"));
var_dump(xmlwriter_start_attribute($xw, "attr"));
var_dump(xmlwriter_end_attribute($xw));
try {
xmlwriter_start_attribute($xw, "-1");
} catch (ValueError $e) {
echo $e->getMessage(), "
";
}
var_dump(xmlwriter_end_attribute($xw));
try {
xmlwriter_start_attribute($xw, "\"");
} catch (ValueError $e) {
echo $e->getMessage(), "
";
}
var_dump(xmlwriter_end_attribute($xw));
var_dump(xmlwriter_end_element($xw));
// Force to write and empty the buffer
xmlwriter_flush($xw, empty: true);
unset($xw);
var_dump(file_get_contents($file));
@unlink($file);
echo "Done
";
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, "-1" given
bool(false)
xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, """ given
bool(false)
bool(true)
string(14) "<tag attr=""/>"
Done
Did this file decode correctly?
Original Code
--TEST--
xmlwriter_start/end_attribute()
--EXTENSIONS--
xmlwriter
--FILE--
<?php
$file = __DIR__.'/010.tmp';
$xw = xmlwriter_open_uri($file);
var_dump(xmlwriter_start_element($xw, "tag"));
var_dump(xmlwriter_start_attribute($xw, "attr"));
var_dump(xmlwriter_end_attribute($xw));
try {
xmlwriter_start_attribute($xw, "-1");
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
var_dump(xmlwriter_end_attribute($xw));
try {
xmlwriter_start_attribute($xw, "\"");
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
var_dump(xmlwriter_end_attribute($xw));
var_dump(xmlwriter_end_element($xw));
// Force to write and empty the buffer
xmlwriter_flush($xw, empty: true);
unset($xw);
var_dump(file_get_contents($file));
@unlink($file);
echo "Done\n";
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, "-1" given
bool(false)
xmlwriter_start_attribute(): Argument #2 ($name) must be a valid attribute name, """ given
bool(false)
bool(true)
string(14) "<tag attr=""/>"
Done
Function Calls
None |
Stats
MD5 | 9a0583ee009d7b6c67f0790de8112d61 |
Eval Count | 0 |
Decode Time | 80 ms |