php / php/php-src

Segmentation fault (stack overflow) in Zend

Open
#15,869 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Engine Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
function test($vars) {
}
function foo() {
foreach ($array as $value) {
try {
try {
foreach ($array as $_) {
}
} finally {
throw new Exception;
}
} catch (Exception $e) { }
}
}
for ($i=0; $fusion < 550; $i++) {
$array = array($array);
}

Resulted in this output:

Segmentation fault (core dumped)

this seems to crash very old php like php 5.5

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. First reproduce the segmentation fault on PHP 8.4.0-dev under Ubuntu 22.04 using the supplied nested foreach/try-finally code and recursive array construction, then trace the Zend execution path involved; done means the reproducer no longer crashes and a regression test covers it.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.