Skip to content

Assertion failure in WeakMap offset operations on reference #20073

Closed

Description

@vi3tL0u1s

Description

The following code:

<?php
$obj = new stdClass;
$map = new WeakMap;
$map[$obj] = 0;
$map[$obj] = // /a[0] /N//@ //'//y['///@// rsort($a)z,= $ 2 $Z// $d,
& $a ===//q// b $$obj2, 43));
var_dump($map->offsetGet($obj ));
var_dump($map->offsetExists($obj ));
?>

Resulted in this output:

php: Zend/zend_vm_execute.h:2165: const zend_op *ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER(zend_execute_data *, const zend_op *): Assertion `(call->func->common.fn_flags & (1 << 12)) ? (zval_get_type(&(*(ret))) == 10) : !(zval_get_type(&(*(ret))) == 10)' failed.
Aborted

Commit

c39c880824e

Configurations

CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic

PHP Version

PHP 8.5.0-dev (cli) (built: Oct  6 2025 14:06:35) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0-dev, Copyright (c), by Zend Technologies

Operating System

Ubuntu 22.04

Activity

  1. ndossche commented on Oct 6, 2025

    @ndossche
    Member

    Not looked in detail yet, but this should probably use the _DEREF variant:

    ZVAL_COPY(return_value, zv);

    While at it, use RETURN_COPY_DEREF
    I could do it this evening.

  2. changed the title [-]Assertion failure in WeakMap offset operations[/-] [+]Assertion failure in WeakMap offset operations on reference[/+] on Oct 6, 2025
  3. added a commit that references this issue on Oct 6, 2025
    0eb65e5
  4. added 2 commits that reference this issue on Oct 7, 2025
    b16761e
    b47c3b6
  5. added 2 commits that reference this issue on Oct 7, 2025
    544617a
    7f5c3cd
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