php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9467 parse error when closing function in require()/include() file
Submitted: 2001-02-26 14:35 UTC Modified: 2001-02-26 15:04 UTC
From: danielc at analysisandsolutions dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: NT 4.0 sp 6a
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: danielc at analysisandsolutions dot com
New email:
PHP Version: OS:

 

 [2001-02-26 14:35 UTC] danielc at analysisandsolutions dot com
Hi:

A parse error arises if a function was opened in the main file and closed in a require()'d or include()'d file.

I'm actually using PHP 4.0.5-dev for windows, 2001-02-20.  This problem also existed in 4.0.4-dev.  Note, the problem does not happen in PHP 3.0.16.

Here are the test scripts:

========== req-test.php ================
<?php

function Tester() {

   include('./req-test.inc');

   # Note, the function has its closing 
   # "}" inside the required file.


echo '<p>hi there from the main file</p>';

Tester();

?>
========================================
========== req-test.inc ================
<?php
   # This is still inside the function.

   echo '<p>Hi there from inside the function';
   echo ' that is continued inside the required file</p>';

}# End function Tester

?>
========================================


Thanks,

--Dan

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-26 15:04 UTC] cynic@php.net
This has changed some time ago. Every file (the "main" one, and any included/required) must be valid PHP scripts in themselves.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 17:02:17 2025 UTC