Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken RC inference for op1 of FETCH_OBJ with magic methods #17151

Closed
iluuu1994 opened this issue Dec 13, 2024 · 0 comments
Closed

Broken RC inference for op1 of FETCH_OBJ with magic methods #17151

iluuu1994 opened this issue Dec 13, 2024 · 0 comments

Comments

@iluuu1994
Copy link
Member

Description

The following code:

<?php

class C {
    public function __get($name) {
        return $this;
    }
}

function test() {
    $x = (new C)->bar;
    var_dump($x);
}

test();

Resulted in this output:

php: Zend/zend_objects_API.c:162: zend_objects_store_del: Assertion `zend_gc_refcount(&(object)->gc) == 0' failed. 

But I expected this output instead:

object(C)#%d (0) {
}

The problem here is that we don't create a new definition for op1 for FETCH_OBJ. This was discovered during development of GH-17130.

PHP Version

PHP 8.2+

Operating System

No response

@iluuu1994 iluuu1994 self-assigned this Dec 13, 2024
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Dec 13, 2024
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Dec 13, 2024
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Dec 18, 2024
iluuu1994 pushed a commit to iluuu1994/php-src that referenced this issue Dec 18, 2024
iluuu1994 added a commit to iluuu1994/php-src that referenced this issue Dec 18, 2024
iluuu1994 pushed a commit to iluuu1994/php-src that referenced this issue Dec 18, 2024
iluuu1994 added a commit that referenced this issue Dec 18, 2024
iluuu1994 added a commit that referenced this issue Dec 18, 2024
* PHP-8.4:
  Fix RC inference of op1 of FETCH_OBJ and INIT_METHOD_CALL
  Add tests for GH-17151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant