# Segfault in HEAD

- Thread: https://externals.io/message/8840
- Original archive: https://news-web.php.net/php.internals/8840
- Started by Antony Dovgal on 2004-03-31T07:06:49+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #8840 — Antony Dovgal — 2004-03-31T07:06:49+00:00

URL: https://externals.io/message/8840#8840

Hi all!

This small script:
<?

class test {
	var $a = false;
	var $x = false;
	
	function getA() {
		if (!$this->x) { // yep, I know, it's infinite loop
			$this->foo();
		}
		return $this->a;
	}

	function foo() {
		return $this->getA();
	}
}

$test = new test;
$test->getA();

?>
produces segfault in latest HEAD.

A small part of backtrace(it's really huge) is below:

Program received signal SIGSEGV, Segmentation fault.
0x40325455 in zend_fetch_obj_r_handler (execute_data=0xbf8000e0, opline=0x40f3a96c, op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:2120
2120            zend_fetch_property_address_read(&opline->result, &opline->op1, &opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
(gdb) bt
#0  0x40325455 in zend_fetch_obj_r_handler (execute_data=0xbf8000e0, opline=0x40f3a96c, op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:2120
#1  0x403237ba in execute (op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:1391
#2  0x40326f19 in zend_do_fcall_common_helper (execute_data=0xbf800210, opline=0x40f3acc0, op_array=0x40f39d6c) at /home/tony/CVS/php-src/Zend/zend_execute.c:2728
#3  0x40327223 in zend_do_fcall_by_name_handler (execute_data=0x40f39b84, opline=0x40f3a970, op_array=0x40f3a970) at /home/tony/CVS/php-src/Zend/zend_execute.c:2810
#4  0x403237ba in execute (op_array=0x40f39d6c) at /home/tony/CVS/php-src/Zend/zend_execute.c:1391
#5  0x40326f19 in zend_do_fcall_common_helper (execute_data=0xbf800390, opline=0x40f3aa9c, op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:2728
#6  0x40327223 in zend_do_fcall_by_name_handler (execute_data=0x40f39b84, opline=0x40f3a970, op_array=0x40f3a970) at /home/tony/CVS/php-src/Zend/zend_execute.c:2810
#7  0x403237ba in execute (op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:1391
#8  0x40326f19 in zend_do_fcall_common_helper (execute_data=0xbf8004c0, opline=0x40f3acc0, op_array=0x40f39d6c) at /home/tony/CVS/php-src/Zend/zend_execute.c:2728
#9  0x40327223 in zend_do_fcall_by_name_handler (execute_data=0x40f39b84, opline=0x40f3a970, op_array=0x40f3a970) at /home/tony/CVS/php-src/Zend/zend_execute.c:2810
#10 0x403237ba in execute (op_array=0x40f39d6c) at /home/tony/CVS/php-src/Zend/zend_execute.c:1391
#11 0x40326f19 in zend_do_fcall_common_helper (execute_data=0xbf800640, opline=0x40f3aa9c, op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:2728
#12 0x40327223 in zend_do_fcall_by_name_handler (execute_data=0x40f39b84, opline=0x40f3a970, op_array=0x40f3a970) at /home/tony/CVS/php-src/Zend/zend_execute.c:2810
#13 0x403237ba in execute (op_array=0x40f39b84) at /home/tony/CVS/php-src/Zend/zend_execute.c:1391
....

---
WBR,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com

---

## #8841 — Derick Rethans — 2004-03-31T07:27:42+00:00

URL: https://externals.io/message/8840#8841 · In reply to: #8840

> Hi all!
>
> This small script:
> <?
>
> class test {
> 	var $a = false;
> 	var $x = false;
>
> 	function getA() {
> 		if (!$this->x) { // yep, I know, it's infinite loop

PHP always crashes on infinite loops as you might be aware off. You'll
have to live with it.

regards,
Derick

---

## #8842 — Antony Dovgal — 2004-03-31T07:32:34+00:00

URL: https://externals.io/message/8840#8842 · In reply to: #8841

On Wed, 31 Mar 2004 09:27:42 +0200 (CEST)
Derick Rethans <derick@php.net> wrote:

> 
> 
> > […]
> 
> PHP always crashes on infinite loops as you might be aware off. You'll
> have to live with it.

And there is no workarounds at all?
(BTW, same results with PHP_4_3..)

---
WBR,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com

---

## #8843 — Derick Rethans — 2004-03-31T07:45:38+00:00

URL: https://externals.io/message/8840#8843 · In reply to: #8842

> > […]
>
> And there is no workarounds at all?
> (BTW, same results with PHP_4_3..)

Just don't make infinite loops? :)

Derick

---

## #8845 — Sterling Hughes — 2004-03-31T18:17:43+00:00

URL: https://externals.io/message/8840#8845 · In reply to: #8841

php5 shouldn't crash _at all_ within an infinite loop because we aren't 
in one big execution loop.

-sterling



> 
>
> > […]
>
> PHP always crashes on infinite loops as you might be aware off. You'll
> have to live with it.
>
> regards,
> Derick

---

## #8846 — George Schlossnagle — 2004-03-31T18:22:41+00:00

URL: https://externals.io/message/8840#8846 · In reply to: #8845

> php5 shouldn't crash _at all_ within an infinite loop because we 
> aren't in one big execution loop.

Why shouldn't this crash eventually?  You still have to account for all 
the callers stacks.

George
