Category
Regression · php-src-strict · typed option value Warning
Problem
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, null) returns true on both Zend 8.4 and the VM, but Zend also emits an E_WARNING that argument #3 must be string|int|bool. The VM is silent (null is accepted and cast via (bool)).
Probed 2026-08-13 (php:8.4-cli -n vs PHP_COMPILER_PROFILE=8.4 php bin/vm.php):
| Repro |
Zend 8.4 |
VM PROFILE=8.4 |
xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, null) |
Warning: Argument #3 ($value) must be of type string|int|bool, null given → true |
true (no warning) |
php-src reference
PHP implementation target
ext/xml/xml_parser_set_option.php — reject/warn on TYPE_NULL before calling XmlParserHandlers::setOption
ext/xml/XmlParserHandlers.php — keep option apply logic; warning belongs at the builtin boundary
- Prefer PHP warning emission helpers already used by other ext/xml builtins; no new C
Repro
./script/docker-exec.sh -- bash -lc 'cat >/tmp/xml_opt.php <<'\''PHP'\''
<?php
error_reporting(E_ALL);
$p = xml_parser_create();
try { var_export(xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, null)); } catch (Throwable $e) { echo get_class($e), ": ", $e->getMessage(); }
xml_parser_free($p);
PHP
PHP_COMPILER_PROFILE=8.4 php bin/vm.php /tmp/xml_opt.php'
Done when
Category
Regression· php-src-strict · typed option value WarningProblem
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, null)returnstrueon both Zend 8.4 and the VM, but Zend also emits anE_WARNINGthat argument #3 must bestring|int|bool. The VM is silent (null is accepted and cast via(bool)).Probed 2026-08-13 (
php:8.4-cli -nvsPHP_COMPILER_PROFILE=8.4 php bin/vm.php):xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, null)truetrue(no warning)php-src reference
ext/xml/xml.c—PHP_FUNCTION(xml_parser_set_option)value zpp / type checkext/xml/xml.stub.php—$valuetypedstring|int|boolPHP implementation target
ext/xml/xml_parser_set_option.php— reject/warn onTYPE_NULLbefore callingXmlParserHandlers::setOptionext/xml/XmlParserHandlers.php— keep option apply logic; warning belongs at the builtin boundaryRepro
Done when
$valueemits Zend-matchingE_WARNINGtext and still returnstrue(php-src behavior)