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
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: tony at marston-home dot demon dot co dot uk
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC