From: geoffers+phpbugs at gmail dot com
Operating system: Mac OS 10.5.7
PHP version: 5.3CVS-2009-06-09 (CVS)
PHP Bug Type: XML Writer
Bug description: libxml_get_errors() returns an empty array but
libxml_get_last_error() doesn't
Description:
------------
I would expect the last member of the array returned by
libxml_get_errors() to be equal to libxml_get_last_error(), but the former
returns an empty array while the latter returns the expected error object.
Reproduce code:
---------------
<?php
$foo = new XMLWriter();
$foo->openMemory();
$foo->startElement("\xEF\xBF\xBF");
var_dump(libxml_get_last_error());
var_dump(libxml_get_errors());
var_dump(libxml_get_last_error() == end(libxml_get_errors()));
Expected result:
----------------
Warning: XMLWriter::startElement(): Char 0xFFFF out of allowed range in
/Users/gsnedders/Desktop/test.php on line 5
Warning: XMLWriter::startElement(): Invalid Element Name in
/Users/gsnedders/Desktop/test.php on line 5
object(LibXMLError)#2 (6) {
["level"]=>
int(3)
["code"]=>
int(9)
["column"]=>
int(0)
["message"]=>
string(33) "Char 0xFFFF out of allowed range
"
["file"]=>
string(0) ""
["line"]=>
int(0)
}
array(1) {
[0]=>
object(LibXMLError)#2 (6) {
["level"]=>
int(3)
["code"]=>
int(9)
["column"]=>
int(0)
["message"]=>
string(33) "Char 0xFFFF out of allowed range
"
["file"]=>
string(0) ""
["line"]=>
int(0)
}
}
bool(true)
Actual result:
--------------
Warning: XMLWriter::startElement(): Char 0xFFFF out of allowed range in
/Users/gsnedders/Desktop/test.php on line 5
Warning: XMLWriter::startElement(): Invalid Element Name in
/Users/gsnedders/Desktop/test.php on line 5
object(LibXMLError)#2 (6) {
["level"]=>
int(3)
["code"]=>
int(9)
["column"]=>
int(0)
["message"]=>
string(33) "Char 0xFFFF out of allowed range
"
["file"]=>
string(0) ""
["line"]=>
int(0)
}
array(0) {
}
bool(false)
--
Edit bug report at http://bugs.php.net/?id=48511&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48511&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48511&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48511&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48511&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48511&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48511&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48511&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48511&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48511&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48511&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48511&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48511&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48511&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48511&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48511&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48511&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48511&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48511&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48511&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48511&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48511&r=mysqlcfg