Skip to content

Regression: get_browser(..., null) $return_array under strict_types DEP+false — Zend TypeError (ext/standard/browscap.c) #31289

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Under declare(strict_types=1), get_browser($user_agent = null, $return_array = null) must TypeError on bool $return_array. Zend accepts null $user_agent (optional) and TypeErrors on null $return_array. VM soft-deprecates (message even cites parameter #1 ($return_array)), warns that browscap is unset, and returns false.

Repro Zend 8.2.32 (2026-08-15) VM (2026-08-15)
declare(strict_types=1); get_browser(null, null) TypeError: get_browser(): Argument #2 ($return_array) must be of type bool, null given E_DEPRECATED (param #1 ($return_array)) + browscap warning + false

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'php -r '\''declare(strict_types=1); try { var_export(get_browser(null, null)); } catch (Throwable $e) { echo get_class($e), ": ", $e->getMessage(), "\n"; }'\'''
./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r '\''declare(strict_types=1); try { var_export(get_browser(null, null)); } catch (Throwable $e) { echo get_class($e), ": ", $e->getMessage(), "\n"; }'\'''

Done when

  • VM/JIT/AOT: null $return_array under strict_types → Zend TypeError (no browscap warning / false)
  • Null $user_agent alone still allowed (Zend optional)
  • Compliance .phpt under test/compliance/cases/stdlib/
  • php-src-strict; no php-compiler-strict shortcut

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:compilerCompiler / CFG / JITarea: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