From:             missingno at ifrance dot com
Operating system: WinXP
PHP version:      5.0.4
PHP Bug Type:     Scripting Engine problem
Bug description:  require() language construct broken?

Description:
------------
I think the require language construct may be broken in PHP 5.0.4 under
Windows/Apache2 as it seems to ignore return statements in conditionnal
blocks.

Note: if you set $myvar to 0 in the code, there's no such problem.

Reproduce code:
---------------
<? // testfile.php
$myvar = 1;
include('maininc.php');
myfunc();
?>

<? // maininc.php
if ($myvar == 1) { require('sndinc.php'); return; }
function myfunc() { echo "Exec'ed from maininc.php!!"; }
?>

<? // sndinc.php
function myfunc() { echo "Second included file..."; }
?>

Expected result:
----------------
I would expect the script to simply echo "Second included file..." and
terminate.

Actual result:
--------------
Fatal error: Cannot redeclare myfunc() (previously declared in
D:\HTTPd\www\tests\maininc.php:8) in D:\HTTPd\www\tests\sndinc.php on line
5

-- 
Edit bug report at http://bugs.php.net/?id=33979&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33979&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33979&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33979&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33979&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33979&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33979&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33979&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33979&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33979&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33979&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33979&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33979&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33979&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33979&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33979&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33979&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33979&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33979&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33979&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33979&r=mysqlcfg

Reply via email to