Skip to content

Language: isset() on property hooks must not invoke get hook (zend_property_hooks.c, php-src-strict) #8917

Description

@PurHur

Category

language · php-src-strict

Problem

On PHP 8.4 property hooks, isset($obj->hooked) must use Zend's isset-style backing probe and must not call the get hook. This compiler invokes the get hook, so virtual/write-only properties with throwing getters fatal instead of returning false.

Distinct from #5203 (get_object_vars() must call get hooks) and from #8732 (json_encode get-hook rule).

Related closed issues that did not cover isset() specifically: #8901 (empty()), #8902 (??).

php-src reference

Repro

Save as test/repro/issue_property_hook_isset.php:

<?php
class C {
    public ?string $x {
        get { throw new Exception('get must not run for isset'); }
    }
}
$c = new C();
var_dump(isset($c->x));
echo "ok\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/issue_property_hook_isset.php
php bin/vm.php test/repro/issue_property_hook_isset.php
'
Runtime Expected Observed (2026-06-16)
Zend 8.4+ bool(false) + ok
VM same Fatal: get must not run for isset

Scope (this repo)

Area Files
VM lib/VM.phpissetPropertyHookProbe() / opcode OP_ISSET on hooked props
JIT lib/JIT/PropertyHookDispatch.php — mirror isset probe without get-hook call
Tests test/compliance/cases/language/property_hook_isset.phpt

PHP-in-PHP first — no new runtime/*.c branches.

Done when

Links

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-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions