#42438 [NEW]: require require_once include include_once

From: Date: Mon, 27 Aug 2007 08:40:23 +0000
Subject: #42438 [NEW]: require require_once include include_once
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116696@lists.php.net to get a copy of this message
From: perching_eagle at yahoo dot com Operating system: windows xp PHP version: 5.2.3 PHP Bug Type: Scripting Engine problem Bug description: require require_once include include_once Description: ------------ the require, require_once, include, include_once operators produce unexpected results when used to import files in php v5.2.3, this problem didn't exist in the previous version i was using. two files contain two different classes that have a parent and child relationship. if both classes are on the same file, the scripting engine outputs the expected result. however, if they are kept in separate files and any of the four import operators are used, the scripting engine dumps jargons on the output screen. pls. try out the example before closing, suspending or the changing the status of this complaint to bogus. Bug #41855 is the same problem as this one, but someone rushed to conclusions without testing and proclaimed it bogus. Reproduce code: --------------- <?php // "parent.php" class Father{ public $surname; public function __construct($name){ $this->surname=$name; } } ?> //******************************************** //separate files //******************************************** <?php // "child.php" include_once("parent.php"); class Son extends Father{ public $name; public function __construct($first,$last){ parent::__construct($last); $this->name=$first; } } $boy=new Son("john","doe"); print $boy->name; print "<br>"; print $boy->surname; ?> Expected result: ---------------- john doe Actual result: -------------- surname=$name; } } ?>&#17930;&#29793;&#27745;&#25888;&#29298;&#29295;›&#27715;&#29537;&#8307;&#17959;&#29793;&#25960;&#10098;&#28192;&#29807;&#26144;&#30063;&#25710;&#26912;&#8302;&#14915;&#17500;&#25455;&#28021;&#28261;&#29556;&#24864;&#25710;&#21280;&#29797;&#26996;&#26478;&#23667;&#28537;&#26989;&#29472;&#29551;&#28257;&#24953;&#17500;&#29541;&#29803;&#28783;&#30556;&#29295;&#8299;&#25954;&#25454;&#23656;&#26736;&#8304;&#26982;&#25964;&#23667;&#28798;&#28776;&#25956;&#26995;&#28263;&#29285;&#28511;&#29813;&#30064;&#24436;&#28020;&#11888;&#26736;&#8304;&#28271;&#27680;&#28265;&#8293;&#2611; -- Edit bug report at http://bugs.php.net/?id=42438&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42438&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42438&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42438&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42438&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42438&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42438&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42438&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42438&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42438&r=support Expected behavior: http://bugs.php.net/fix.php?id=42438&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42438&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42438&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42438&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42438&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42438&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42438&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42438&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42438&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42438&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42438&r=mysqlcfg

« previous php.bugs (#116696) next »