mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix crash when toggleAttribute() is used without a document
This commit is contained in:
1
NEWS
1
NEWS
@@ -20,6 +20,7 @@ PHP NEWS
|
|||||||
- DOM:
|
- DOM:
|
||||||
. Fixed bug GH-12870 (Creating an xmlns attribute results in a DOMException).
|
. Fixed bug GH-12870 (Creating an xmlns attribute results in a DOMException).
|
||||||
(nielsdos)
|
(nielsdos)
|
||||||
|
. Fix crash when toggleAttribute() is used without a document. (nielsdos)
|
||||||
|
|
||||||
- FFI:
|
- FFI:
|
||||||
. Fixed bug GH-9698 (stream_wrapper_register crashes with FFI\CData).
|
. Fixed bug GH-9698 (stream_wrapper_register crashes with FFI\CData).
|
||||||
|
|||||||
@@ -1554,7 +1554,7 @@ PHP_METHOD(DOMElement, toggleAttribute)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Step 2 */
|
/* Step 2 */
|
||||||
if (thisp->doc->type == XML_HTML_DOCUMENT_NODE && (thisp->ns == NULL || xmlStrEqual(thisp->ns->href, (const xmlChar *) "http://www.w3.org/1999/xhtml"))) {
|
if (thisp->doc != NULL && thisp->doc->type == XML_HTML_DOCUMENT_NODE && (thisp->ns == NULL || xmlStrEqual(thisp->ns->href, (const xmlChar *) "http://www.w3.org/1999/xhtml"))) {
|
||||||
qname_tmp = zend_str_tolower_dup_ex(qname, qname_length);
|
qname_tmp = zend_str_tolower_dup_ex(qname, qname_length);
|
||||||
if (qname_tmp != NULL) {
|
if (qname_tmp != NULL) {
|
||||||
qname = qname_tmp;
|
qname = qname_tmp;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
--TEST--
|
||||||
|
DOMElement::toggleAttribute() without a document
|
||||||
|
--EXTENSIONS--
|
||||||
|
dom
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$element = new DOMElement("container");
|
||||||
|
$element->toggleAttribute('foo', true);
|
||||||
|
|
||||||
|
$dom = new DOMDocument;
|
||||||
|
$element = $dom->importNode($element, true);
|
||||||
|
echo $dom->saveXML($element), "\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
<container foo=""/>
|
||||||
Reference in New Issue
Block a user