View Issue Details

IDProjectCategoryView StatusLast Update
0002287XdebugUncategorizedpublic2024-11-27 15:55
Reporterbkdotcom Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionno change required 
PlatformXdebug v3.4.0alpha2-deOSOSXOS Version12.7.6
Summary0002287: zend_mm_heap corrupted in develop mode
Description

Reflecting a class containing new php 8.4 features (property hooks / asymmetric-visibility) with xdebug.mode = develop leads to

zend_mm_heap corrupted
Abort trap: 6

Steps To Reproduce
<?php

/**
 * PHP 8.4 property hooks & asymmetric visibility
 */
class NewFeatures
{
    public protected(set) ?string $name;
    protected private(set) ?int $age;

    // public static array $static = [];

    public ?string $backedGetOnly {
        get => $this->backedGetOnly;
    }

    public ?string $backedSetOnly {
        set (?string $value) {
            $this->backedSetOnly = $value;
        }
    }

    public ?string $backedGetAndSet {
        set (?string $value) {
            $this->backedGetAndSet = $value;
        }

        get => $this->backedGetAndSet;
    }

    public $things = [];

    public string $virtualGetOnly {
        get => \implode(', ', $this->things);
    }

    public string $virtualSetOnly {
        set (string $value) {
            $this->things[] = $value;
        }
    }

    public string $virtualGetAndSet {
        set (string $value) {
            $this->things[] = $value;
        }

        get => \implode(', ', $this->things);
    }
}

$newFeatures = new NewFeatures();

$refObj = new ReflectionObject($newFeatures);
$refProps = $refObj->getProperties();

foreach ($refProps as $refProp) {
    propInfo($refProp, $newFeatures);
}

echo 'the end' . "\n\n";

function propInfo(ReflectionProperty $refProperty, $obj)
{
    $info = array(
        'hooks' => \array_keys($refProperty->getHooks()),
        'isVirtual' => $refProperty->isVirtual(), // at least one hook and none of the hooks reference the property
        'value' => null,
    );
    $isWriteOnly = $info['isVirtual'] && \in_array('get', $info['hooks'], true) === false;
    if ($isWriteOnly) {
        return;
    }
    $refProperty->setAccessible(true);
    if ($refProperty->isInitialized($obj)) {
        try {
            $info['value'] = $refProperty->isStatic() === false && $refProperty->isVirtual() === false
                ? $refProperty->getRawValue($obj)
                : $refProperty->getValue($obj);
        } catch (\Error $e) {
            echo 'Error: ' . $e->getMessage() . "\n";
        }
    }
}
Additional Information

commenting out any one of the properties and the script will complete... some sort of internal buffer issue?!

TagsNo tags attached.
Operating Systemosx
PHP Version8.4-dev

Activities

bkdotcom

2024-09-06 13:21

reporter   ~0007050

sorry about the formatting... I don't see and option to fix/edit it :|

derick

2024-10-04 14:33

administrator   ~0007053

Attachment for reproducing script.

2287.php (2,036 bytes)   

derick

2024-10-08 15:26

administrator   ~0007066

I didn't manage to reproduce this. Can you share the output of xdebug_info()?

bkdotcom

2024-10-13 19:56

reporter   ~0007076

xdebug_info output attached

xdebug_info.txt (3,914 bytes)   

derick

2024-10-16 16:22

administrator   ~0007077

Hi,

I've tried it again, with the exact same settings as you have, but no success in reproducing this. Can you try Xdebug 3.4.0beta1 perhaps?

cheers,
Derick

bkdotcom

2024-10-18 01:15

reporter   ~0007078

CAN BE CLOSED

Working for me now (more recent php 8.4 build)

php -v
PHP 8.4.0-dev (cli) (built: Oct 18 2024 00:15:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.0-dev, Copyright (c) Zend Technologies
with Xdebug v3.4.0alpha2-dev, Copyright (c) 2002-2024, by Derick Rethans

Thank you for your time!
with Zend OPcache v8.4.0-dev, Copyright (c), by Zend Technologies

derick

2024-11-27 15:55

administrator   ~0007089

Thanks for letting me know. If it returns with Xdebug 3.4.0 (out soon), then please open a new ticket!

cheers,
Derick

Issue History

Date Modified Username Field Change
2024-09-05 21:04 bkdotcom New Issue
2024-09-06 13:21 bkdotcom Note Added: 0007050
2024-10-04 14:32 derick Steps to Reproduce Updated
2024-10-04 14:33 derick Note Added: 0007053
2024-10-04 14:33 derick File Added: 2287.php
2024-10-08 15:26 derick Assigned To => derick
2024-10-08 15:26 derick Status new => feedback
2024-10-08 15:26 derick Note Added: 0007066
2024-10-13 19:56 bkdotcom Note Added: 0007076
2024-10-13 19:56 bkdotcom File Added: xdebug_info.txt
2024-10-13 19:56 bkdotcom Status feedback => assigned
2024-10-16 16:22 derick Status assigned => feedback
2024-10-16 16:22 derick Note Added: 0007077
2024-10-18 01:15 bkdotcom Note Added: 0007078
2024-10-18 01:15 bkdotcom Status feedback => assigned
2024-11-27 15:55 derick Status assigned => resolved
2024-11-27 15:55 derick Resolution open => no change required
2024-11-27 15:55 derick Note Added: 0007089