php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #733 return in global scope causes parser error
Submitted: 1998-09-10 01:11 UTC Modified: 2000-07-05 02:34 UTC
From: walton at nordicdms dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.3 OS: FreeBSD 2.2.6
Private report: No CVE-ID: None
 [1998-09-10 01:11 UTC] walton at nordicdms dot com
Including or requiring a file that looks like this:

<?
  if (defined('MY_INCLUDE_FILE')) { 
    return;
  }
  define('MY_INCLUDE_FILE', 1);

  ...
?>

causes a parser error on the last line of the main script if this file is included more than once.  The parser error can be silenced by adding one } to the end of the main script for each time that "return" executes.

For example, if that file is included 3 times, }} must be added to the end of the script.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-05 02:34 UTC] rasmus at cvs dot php dot net
Fixed long ago
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 18:01:28 2024 UTC