Skip to content

Stdlib: mb_strstr() missing — undefined function fatal (ext/mbstring/mbstring.c) #19941

Description

@PurHur

Category

stdlib · implementation-ready

Problem

mb_strstr() is missing from the VM — function_exists('mb_strstr') returns false and calls fatal with undefined function. Zend provides this in ext/mbstring/mbstring.c.

Sibling functions mb_strpos(), mb_stripos(), mb_strrichr() are all registered; mb_strstr() is the gap.

php-src reference

Repro

<?php
var_dump(mb_strstr('Hello World', 'World'));        // string(5) "World"
var_dump(mb_strstr('Hello World', 'World', true));  // string(6) "Hello "
var_dump(mb_strstr('Hello World', 'xyz'));           // bool(false)
Engine Result
Zend Works as above
VM Fatal: Call to undefined function mb_strstr()

Scope

  • ext/mbstring/mb_strstr.php — new builtin using VmMbstring::strpos() + VmString::utf8CharSubstr()
  • ext/mbstring/Module.php — register
  • test/compliance/cases/stdlib/mb_strstr.phpt

Done when

  • mb_strstr() works on VM matching Zend
  • $before_needle and $encoding params supported
  • Compliance PHPT green

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 machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions