#45480 [Opn]: SIGSEGV crash after calling inherited function in subclass

From: Date: Thu, 10 Jul 2008 23:31:08 +0000
Subject: #45480 [Opn]: SIGSEGV crash after calling inherited function in subclass
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126452@lists.php.net to get a copy of this message
ID: 45480 Updated by: colder@php.net Reported By: oka at ping dot uio dot no Status: Open Bug Type: Reproducible crash Operating System: Linux PHP Version: 5.2.6 New Comment: function print_xml($node, $data) { $this->print_xml($node, $data); } is an infinite recursion. You most likely want parent::print_xml($node, $data); Previous Comments: ------------------------------------------------------------------------ [2008-07-10 22:38:16] oka at ping dot uio dot no Description: ------------ Code with a class and a subclass with constructor functions and a separate function in both classes causes both the Apache 2.0.63 PHP module and the cli that ships with PHP 5.2.6 to emit the SIGSEGV signal. Reproduce code: --------------- <? class Article { var $ai; function Article() { } function print_xml($node, $data) { return "<" . $node . ">" . $data . "</" . $node . ">"; } } class Contribution extends Article { function Contribution() { $this->Article(); } function print_xml($node, $data) { $this->print_xml($node, $data); } } $contrib = new Contribution(); print $contrib->print_xml("tagname", "New"); ?> Expected result: ---------------- <tagname>New</tagname> Actual result: -------------- I put a partial backtrace from gdb 6.4.90-debian online at http://www.ping.uio.no/~oka/php-5.2.6-oka-SIGSEGV/php-5.2.6-oka-SIGSEGV.gdb-session.log ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45480&edit=1

« previous php.bugs (#126452) next »