|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-07 13:39 UTC] kevin dot laushway at nlc-bnc dot ca
A return does not terminate execution of included script.
For Example;
parent.php
<?php
echo "Starting Parent\n";
$m_return = include('./child.php');
echo "Back from Child, return code $m_return\n";
?>
child.php
<?php
echo "Starting Child\n";
return; // this should terminate script
echo "What the heck? I'm still in child\n";
?>
I expect the script to terminate at the return, and "what the heck..." would never be printed. This functioned as expected in previous versions. i.e. 4.0.6
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 23 08:00:01 2025 UTC |
I'm unable to reproduce this on linux: $ cat a.php <? echo "In file a\n"; $include = include 'b.php'; echo "In file a, after file b returned\n"; ?> $ cat b.php <? echo "In file b\n"; return; echo "Still in file b\n"; ?> $ php-4.0.6 -f a.php In file a In file b In file a, after file b returned $ php-4.2.1RC2 -f a.php In file a In file b In file a, after file b returned Can someone test this with those version on win32? Could this by chance be a configuration issue of your php installation?