Bug #78150 [NEW]: Unable to use XMLWriter in Exception-Handler

From: Date: Wed, 12 Jun 2019 15:23:46 +0000
Subject: Bug #78150 [NEW]: Unable to use XMLWriter in Exception-Handler
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221246@lists.php.net to get a copy of this message
From: n dot scheer at binserv dot de Operating system: Centos 7.6 x64 PHP version: 7.3.6 Package: XML Writer Bug Type: Bug Bug description:Unable to use XMLWriter in Exception-Handler Description: ------------ We currently use an exception-handler that writes information about the exception to a xml file. Recently we noticed, that sometimes the resulting xml file is just empty - without any error message being triggered. I was able to reduce the code to the example below. There's no obvious reason why the script should not be able to write the xml content. Interesting thing is: Throwing an exception manually does not trigger this behavior. Test script: --------------- <?php @unlink( '/tmp/err.xml' ); function exception_handler( Throwable $exception ) { echo "exception handler called\n"; $xw = new XMLWriter(); var_dump( $xw ); $xw->openURI( '/tmp/err.xml' ); $xw->startDocument( '1.0', 'UTF-8' ); $xw->startElement( 'error' ); $xw->endElement(); $returnValue = $xw->endDocument(); if ( $returnValue === false ) { die( "unable to write error xml\n" ); } die("error xml written\n"); } # function exception_handler(...) set_exception_handler( 'exception_handler' ); new SoapClient( 'https://localhost/', [] ); #throw new Exception("dummy"); Expected result: ---------------- exception handler called object(XMLWriter)#1 (0) { } error xml written (/tmp/err.xml exists with content <?xml version="1.0" encoding="UTF-8"?> <error/>) Actual result: -------------- exception handler called object(XMLWriter)#1 (0) { } unable to write error xml (/tmp/err.xml exists but is empty) -- Edit bug report at https://bugs.php.net/bug.php?id=78150&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78150&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78150&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78150&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78150&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78150&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78150&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78150&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78150&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78150&r=support Expected behavior: https://bugs.php.net/fix.php?id=78150&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78150&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78150&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78150&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78150&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78150&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78150&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78150&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78150&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78150&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78150&r=mysqlcfg

« previous php.bugs (#221246) next »