Skip to content

Commit faea5ab

Browse files
committed
Throw from XmlReader::expand() if DOM extension missing
Otherwise it is hard to uphold the arginfo contract for this function -- we cannot simply mirror the zpp call, as the class entry it is based on does not exist.
1 parent d3cf597 commit faea5ab

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ext/xmlreader/php_xmlreader.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,13 @@ PHP_METHOD(XMLReader, expand)
11321132
RETURN_THROWS();
11331133
}
11341134
#else
1135-
php_error(E_WARNING, "DOM support is not enabled");
1136-
return;
1135+
zval *dummy;
1136+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z!", &dummy) == FAILURE) {
1137+
RETURN_THROWS();
1138+
}
1139+
1140+
zend_throw_error(NULL, "XMLReader::expand() requires the DOM extension to be enabled");
1141+
RETURN_THROWS();
11371142
#endif
11381143
}
11391144
/* }}} */

ext/xmlreader/php_xmlreader.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ public function setRelaxNGSchemaSource(?string $source) {}
7676
/** @return bool|XMLReader */
7777
public static function XML(string $source, ?string $encoding = null, int $options = 0) {}
7878

79-
/** @return DOMNode|false|null */
79+
/** @return DOMNode|false */
8080
public function expand(?DOMNode $basenode = null) {}
8181
}

ext/xmlreader/php_xmlreader_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 65f093ef5916078c10dd4bff7e854561f153ab9c */
2+
* Stub hash: 7d549429c217e5c3b9c36013b6737f4e8eeccbb6 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_close, 0, 0, 0)
55
ZEND_END_ARG_INFO()

0 commit comments

Comments
 (0)