php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45480 SIGSEGV crash after calling inherited function in subclass
Submitted: 2008-07-10 22:38 UTC Modified: 2008-07-10 23:31 UTC
From: oka at ping dot uio dot no Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
 [2008-07-10 22:38 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-10 23:31 UTC] colder@php.net
  function print_xml($node, $data) {
        $this->print_xml($node, $data);
  }

is an infinite recursion. You most likely want parent::print_xml($node, $data);
 [2008-07-10 23:31 UTC] colder@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 11:01:31 2024 UTC