Skip to content

Commit 940f599

Browse files
committed
Convert check into assertion in ext/xmlreader
$this is requires to be instanceof self for quite a while now, so make this an assertion.
1 parent 3c96d7e commit 940f599

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ext/xmlreader/php_xmlreader.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -845,12 +845,9 @@ PHP_METHOD(XMLReader, open)
845845

846846
id = getThis();
847847
if (id != NULL) {
848-
if (! instanceof_function(Z_OBJCE_P(id), xmlreader_class_entry)) {
849-
id = NULL;
850-
} else {
851-
intern = Z_XMLREADER_P(id);
852-
xmlreader_free_resources(intern);
853-
}
848+
ZEND_ASSERT(instanceof_function(Z_OBJCE_P(id), xmlreader_class_entry));
849+
intern = Z_XMLREADER_P(id);
850+
xmlreader_free_resources(intern);
854851
}
855852

856853
if (!source_len) {
@@ -1025,10 +1022,8 @@ PHP_METHOD(XMLReader, XML)
10251022
}
10261023

10271024
id = getThis();
1028-
if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), xmlreader_class_entry)) {
1029-
id = NULL;
1030-
}
10311025
if (id != NULL) {
1026+
ZEND_ASSERT(instanceof_function(Z_OBJCE_P(id), xmlreader_class_entry));
10321027
intern = Z_XMLREADER_P(id);
10331028
xmlreader_free_resources(intern);
10341029
}

0 commit comments

Comments
 (0)