Skip to content

Assertion failure in Zend/zend_operators.c:1045 #16185

Closed

Description

@YuanchengJiang

Description

The following code:

<?php
class ByRef {
private $_virtualByRef = 'virtualByRef';
}
class ByVal extends ByRef {
public $_virtualByRef {
get {
}
set {
$this->backedUninitialized = $value;
}
}
}
function testByVal($object) {
foreach ($object as $prop => $value) {
echo "$prop => $value\n";
$object->{$prop} = strtoupper($value);
}
}
testByVal(new ByVal);

Resulted in this output:

php: /php-src/Zend/zend_operators.c:1045: __zval_get_string_func: Assertion `0' failed.
Aborted (core dumped)

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Activity

  1. changed the title [-]Assertion failure in Zend/zend_operators.c[/-] [+]Assertion failure in Zend/zend_operators.c:1045[/+] on Oct 3, 2024
  2. DanielEScherzer commented on Oct 3, 2024

    @DanielEScherzer
    Member

    Minimal reproduction:

    <?php
    class ByRef {
        private $_virtualByRef = 'virtualByRef';
    }
    class ByVal extends ByRef {
        public $_virtualByRef {
            get {}
            set { $this->unused = $value; }
        }
    }
    $object = new ByVal;
    foreach ($object as $value) {
        echo $value;
        $object->_virtualByRef = $value;
    }

    produces

    root@3acd01cef279:/usr/src/php# php /var/www/html/test.php 
    
    Deprecated: Creation of dynamic property ByVal::$unused is deprecated in /var/www/html/test.php on line 8
    php: /usr/src/php/Zend/zend_operators.c:1045: __zval_get_string_func: Assertion `0' failed.
    Aborted
    
  3. cmb69 commented on Oct 3, 2024

    @cmb69
    Member

    __zval_get_string_func() gets called with an IS_CALLABLE. Since this is apparently related to property hooks, maybe @iluuu1994 can have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions