View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002287 | Xdebug | Uncategorized | public | 2024-09-05 21:04 | 2024-10-04 14:33 |
Reporter | bkdotcom | Assigned To | |||
Priority | normal | Severity | crash | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | Xdebug v3.4.0alpha2-de | OS | OSX | OS Version | 12.7.6 |
Summary | 0002287: zend_mm_heap corrupted in develop mode | ||||
Description | Reflecting a class containing new php 8.4 features (property hooks / asymmetric-visibility) with zend_mm_heap corrupted | ||||
Steps To Reproduce |
| ||||
Additional Information | commenting out any one of the properties and the script will complete... some sort of internal buffer issue?! | ||||
Tags | No tags attached. | ||||
Operating System | osx | ||||
PHP Version | 8.4-dev | ||||
|
sorry about the formatting... I don't see and option to fix/edit it :| |
|
Attachment for reproducing script. 2287.php (2,036 bytes)
<?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"; } } } |