Skip to content

Regression: xml_parser_set_option(..., null) silent true — Zend E_WARNING string\|int\|bool (ext/xml/xml.c) #30652

Description

@PurHur

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

  • Null $value emits Zend-matching E_WARNING text and still returns true (php-src behavior)
  • Non-null string|int|bool paths unchanged
  • Compliance/unit guard; php-src-strict

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions