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.
This commit is contained in:
Nikita Popov 2020-10-05 12:31:48 +02:00
parent d3cf597328
commit faea5ab837
3 changed files with 9 additions and 4 deletions

View file

@ -1132,8 +1132,13 @@ PHP_METHOD(XMLReader, expand)
RETURN_THROWS();
}
#else
php_error(E_WARNING, "DOM support is not enabled");
return;
zval *dummy;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z!", &dummy) == FAILURE) {
RETURN_THROWS();
}
zend_throw_error(NULL, "XMLReader::expand() requires the DOM extension to be enabled");
RETURN_THROWS();
#endif
}
/* }}} */

View file

@ -76,6 +76,6 @@ class XMLReader
/** @return bool|XMLReader */
public static function XML(string $source, ?string $encoding = null, int $options = 0) {}
/** @return DOMNode|false|null */
/** @return DOMNode|false */
public function expand(?DOMNode $basenode = null) {}
}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 65f093ef5916078c10dd4bff7e854561f153ab9c */
* Stub hash: 7d549429c217e5c3b9c36013b6737f4e8eeccbb6 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_close, 0, 0, 0)
ZEND_END_ARG_INFO()