php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17078 return does not terminate included script
Submitted: 2002-05-07 13:39 UTC Modified: 2002-06-17 09:15 UTC
From: kevin dot laushway at nlc-bnc dot ca Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.0 OS: Dec Alpha OSF1 v5.1
Private report: No CVE-ID: None
 [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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-07 14:57 UTC] mfischer@php.net
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?
 [2002-05-07 15:03 UTC] kevin dot laushway at nlc-bnc dot ca
After futher investigation it seems only to happen with a when running under apache (version 1.3.22).  I'm installing a later version of apache.  I will continue with my investigation.
 [2002-05-07 15:06 UTC] mfischer@php.net
Thanks, please also try the cgi version.
 [2002-05-08 09:22 UTC] kevin dot laushway at nlc-bnc dot ca
I upgraded apache to 1.3.24 and the problem is resolved.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 19:00:03 2025 UTC