mirror of
https://github.com/php/php-src.git
synced 2024-12-12 03:15:29 +08:00
Fixed bug #41175 (addAttribute() fails to add an attribute with an empty
value).
This commit is contained in:
parent
c8925ba493
commit
bc9f8f582c
2
NEWS
2
NEWS
@ -4,6 +4,8 @@ PHP NEWS
|
||||
- Fixed commandline handling fro CLI and CGI. (Marcus, Johannes)
|
||||
- Upgraded SQLite 3 to version 3.3.16 (Ilia)
|
||||
- Updated timezone database to version 2007.5. (Derick)
|
||||
- Fixed bug #41175 (addAttribute() fails to add an attribute with an empty
|
||||
value). (Ilia)
|
||||
- Fixed bug #41159 (mysql_pconnect() hash does not account for connect
|
||||
flags). (Ilia)
|
||||
- Fixed bug #41121 (range() overflow handling for large numbers on 32bit
|
||||
|
@ -1542,7 +1542,7 @@ SXE_METHOD(addAttribute)
|
||||
return;
|
||||
}
|
||||
|
||||
if (qname_len == 0 || value_len == 0) {
|
||||
if (qname_len == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute name and value are required");
|
||||
return;
|
||||
}
|
||||
|
16
ext/simplexml/tests/bug41175.phpt
Normal file
16
ext/simplexml/tests/bug41175.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #41175 (addAttribute() fails to add an attribute with an empty value)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = new SimpleXmlElement("<img></img>");
|
||||
$xml->addAttribute("src", "foo");
|
||||
$xml->addAttribute("alt", "");
|
||||
echo $xml->asXML();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
<?xml version="1.0"?>
|
||||
<img src="foo" alt=""/>
|
||||
Done
|
Loading…
Reference in New Issue
Block a user