|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78409 Segfault when creating instance of ArrayIterator without constructor
Submitted: 2019-08-13 17:00 UTC Modified: 2019-08-15 08:35 UTC
From: nicolas dot grekas+php at gmail dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 7.4.0beta2 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: nicolas dot grekas+php at gmail dot com
New email:
PHP Version: OS:


 [2019-08-13 17:00 UTC] nicolas dot grekas+php at gmail dot com
This is related to the new serialization mechanism of PHP 7.4.
I don't have a better reproducer because when I try to isolate the crash, it works...
Here is my reproducer, sorry I don't have a better one for now:
checkout branch "ve-php74"

Then run
./phpunit src/Symfony/Component/VarExporter/ --do-not-cache-result --filter testExport#6


What the code does is that it:
- uses newInstanceWithoutConstructor to create an ArrayIterator
- clones that instance
- calls __unserialize on the clone instance with a valid payload

The crash happens after these step, when e.g. calling print_r() on the object.
When done "manually", it works. But in the context of the test case, it segfaults. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-15 08:35 UTC]
-Status: Open +Status: Analyzed
 [2019-08-15 08:35 UTC]
I believe the root cause here is this:

$a = new ArrayObject;
$u = [

array(3) {
  NULL        <-- changed to NULL
  array(0) {
 [2019-08-15 08:40 UTC]
Automatic comment on behalf of
Log: Fixed bug #78409
 [2019-08-15 08:40 UTC]
-Status: Analyzed +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 24 19:03:39 2023 UTC