|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-12-06 05:49 UTC] benoit dot david at free dot fr
Description:
------------
The test script below works fine for 10 iterations but crashes (Segmentation fault) for 400000 iterations while it shouldn't crash.
Uses Php 7.2 on docker (Version 17.09.0-ce-mac35 (19611))
with no extension.
Test script:
---------------
<?php
class Lim {
public $id;
public $inv;
public $fi;
function __construct($id) { $this->id = $id; $this->inv = new Inv($this); }
};
class Inv {
public $inv;
public $fi;
function __construct($inv) { $this->inv = $inv; }
}
$max = 400000;
//$max = 10;
$lim0 = new Lim(0);
$limp = $lim0;
for ($i=1; $i<$max; $i++) {
$lim = new Lim($i);
$lim->fi = $limp->inv;
$limp->inv->fi = $lim;
$limp = $lim;
}
Expected result:
----------------
The above script should not crash for 400000 iterations.
Actual result:
--------------
The above script crashes for 400000 iterations.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
Here is the backtrace from gdb: #0 0x0000563b94600d95 in gc_mark_grey ( ref=<error reading variable: Cannot access memory at address 0x7ffd2031bfe8>) at /usr/local/src/php-7.2.0/Zend/zend_gc.c:477 #1 0x0000563b94600efc in gc_mark_grey (ref=0x7f1bed1b2460) at /usr/local/src/php-7.2.0/Zend/zend_gc.c:511