From: a dot eibach at gmx dot net
Operating system: Win98 SE
PHP version: 4.3.1
PHP Bug Type: Reproducible crash
Bug description: Apache CRASH with illegal code (C++ style)
Hi.
What is illegal code? Code with the intention to break something. But
sometimes it's even a bad mistake causing this (inheriting a wrong class
or deriving from an illegal class or...)
The following stuff is really ILLEGAL code. YOU SHOULD NEVER PROGRAM LIKE
THIS. ;) But Apache shouldn't GPF, too. The Apache people warped me over
here because they said that this is no Apache issue. May they be right.
As you can see...
The code is *very* narrowed down. It's definitely not _that_ simple IRL.
Main class is 'db_entry'. Class 'contact' is derived from employer, which
is derived itself from db_entry.
Now we get ILLEGAL. We create a new 'contact' member object by directly
(!!!) instantiating contact from the db_entry constructor. (Of course, we
should instantiate 'employer', because contact is created inside too. But
we want the crash, don't we :))
Crazy thing is that PHP doesn't complain about anything if this is done
with *existing* 'contact()' constructor.
If this is missing or disabled ('//' part), Apache crashes.
OS: Win98 SE
Apache: 1.3.27
PHP: 4.3.1 (stable)
--script--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 FINAL//EN">
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#990000" VLINK="#003366" TEXT="#000000"
TOPMARGIN=16 LEFTMARGIN=10 MARGINWIDTH=10 MARGINHEIGHT=16>
<font face="Arial">
<?php
class employer extends db_entry
{
var $contactman;
function employer() /* constructor */
{
$this->contactman = new contact();
}
}
class contact extends employer
{
// function contact() // this is the constructor and it's MISSING!!!
// { // --> crash
// }
}
class db_entry
{
var $ct_entry;
function db_entry()
{
/* generate indirect member object by illegally
instantiating an object TWO hierarchy steps below!!! */
$this->ct_entry = new contact();
// -> crash!
}
}
$newentr = new db_entry();
echo "OK";
?>
</font>
</BODY>
</HTML>
--
Edit bug report at http://bugs.php.net/?id=23039&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23039&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23039&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23039&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23039&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23039&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23039&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23039&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23039&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23039&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23039&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23039&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23039&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23039&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23039&r=gnused