File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -176,10 +176,13 @@ PHP_METHOD(XSLTProcessor, importStylesheet)
176
176
clone_docu = zend_is_true (cloneDocu );
177
177
zend_string_release_ex (member , 0 );
178
178
if (clone_docu == 0 ) {
179
- /* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */
179
+ /* Check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation.
180
+ * xsl:key elements may only occur at the top level. Furthermore, all elements at the top level must be in a
181
+ * namespace (if not, then the stylesheet is not well-formed and this function will have returned false earlier). */
180
182
nodep = xmlDocGetRootElement (sheetp -> doc );
181
183
if (nodep && (nodep = nodep -> children )) {
182
184
while (nodep ) {
185
+ ZEND_ASSERT (nodep -> ns != NULL );
183
186
if (nodep -> type == XML_ELEMENT_NODE && xmlStrEqual (nodep -> name , (const xmlChar * ) "key" ) && xmlStrEqual (nodep -> ns -> href , XSLT_NAMESPACE )) {
184
187
intern -> hasKeys = true;
185
188
break ;
You can’t perform that action at this time.
0 commit comments