php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22792 cannot use include statement inside a class
Submitted: 2003-03-19 17:07 UTC Modified: 2003-03-19 17:21 UTC
From: tony at marston-home dot demon dot co dot uk Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.1 OS: WindowsXP
Private report: No CVE-ID: None
 [2003-03-19 17:07 UTC] tony at marston-home dot demon dot co dot uk
I have a script containing the following:

<?php
include 'person.class.inc';
$CLperson = new Person;
?>

File person.class.inc contains the following:
<?php
require_once 'std.table.class.inc';
class Person extends Default_Table
{
   ...
}
?>

File std.table.class.inc contains the following:
<?php
class Default Table
{
include 'test.inc';
}
?>

When I run it I get the following error:

"Parse error: parse error, unexpected T_INCLUDE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in F:\Apache2\HTDOCS\XAMPLE\std.table.class.inc on line 4"

The only variation that actually works is:-

$result = include 'test.inc';

BTW, I am using the ISAPI version of PHP under Apache 2.0.44

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-19 17:21 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 05:01:31 2024 UTC