Skip to content

A function declared under a runtime guard (if (false === function_exists(...))) fails to lower: "unsupported statement kind Function". #624

Closed

Description

@blacktrs

Reported in #614 (item 7). Seen in myclabs/deep-copy. if (!function_exists(...)) compiles; the false === ... spelling does not.

<?php
namespace DeepCopy;
if (false === function_exists('DeepCopy\deep_copy')) {
    function deep_copy($v) { return $v; }
}
echo deep_copy("ok"), "\n";

php 8.5: ok · manticore 0.18.0: MIR.lower: unsupported statement kind Function at line 4

Fixed on branch wordpress (unmerged): cdd17ee7 hoists conditional and nested function/class declarations (test tests/aot/cases/decl_nested_conditional.php); repro verified green with that branch's binary.

Activity

  1. added
    bug
    on Nov 10, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions