Skip to content

Segmentation fault Zend/zend_hash.h:1629 #17200

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
class A {
public $prop = 41;
}
class B extends A {
public $prop = 42 {
get {
}
}
}
$b = new B();
var_dump($b);
$fusion = $b;
$inputs =  array (
@$fusion,
);
foreach($inputs as $input) {
var_dump(json_encode($input));
}

Resulted in this output:

object(B)#1 (1) {
  ["prop"]=>
  int(42)
}
Zend/zend_hash.h:1629:20: runtime error: member access within misaligned address 0x0000000000b1 for type 'zend_string' (aka 'struct _zend_string'), which requires 8 byte alignment
0x0000000000b1: note: pointer points here
<memory cannot be printed>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Zend/zend_hash.h:1629:20

PHP Version

nightly

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions