From: Operating system: Linux PHP version: 5.3.10 Package: SimpleXML related Bug Type: Bug Bug description:asXML($filename) url-decodes $filename
Description: ------------ I was saving a SimpleXML object and kept getting errors that the file could not be written. Upon further examination, I discovered that the directory containg an url-encoded slash (%2F) and while the directory existed as an encoded string (e.g. 'dir1%2Fdir2/file.xml') asXML was explicitly unencoding it and attempting to write to a different directory (which does not exist, e.g. 'dir1/dir2.xml'). No amounts of double-encoding the filename succeeded in creating the file successfully (same error) so I had to resort to file_put_contents("{$dirname}/file.xml", $sXML->saveXML()); Test script: --------------- $sXML = new SimpleXMLElement('<result />'); $filename = 'dir1%2Fdir2/result.xml'; mkdir(dirname($filename)); file_put_contents($filename, $sXML->asXML()); // works as expected $sXML->asXML($filename); // fails; no such file/directory Expected result: ---------------- Filename arguments given to asXML should be accepted without url-decoding Actual result: -------------- filenames are being url-decoded, which is not what I want or expect -- Edit bug report at https://bugs.php.net/bug.php?id=61822&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61822&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61822&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61822&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61822&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61822&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61822&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61822&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61822&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61822&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61822&r=support Expected behavior: https://bugs.php.net/fix.php?id=61822&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61822&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61822&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61822&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61822&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61822&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61822&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61822&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61822&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61822&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61822&r=mysqlcfg