php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27569 include/require does not work within class definition
Submitted: 2004-03-11 10:23 UTC Modified: 2004-03-11 10:34 UTC
From: jochen at kokemuller dot de Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.0.0b4 (beta4) OS: Linux
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: jochen at kokemuller dot de
New email:
PHP Version: OS:

 

 [2004-03-11 10:23 UTC] jochen at kokemuller dot de
Description:
------------
require/include does not work within a class definition!
I also found bug #11835 with status closed dealing the same topic, but it doesn't seem closed to me!

Reproduce code:
---------------
<?php
//This is file foo.php

class foo
{
// whatever bar.php
// neither works with include
require("./bar.php");
}

?>


Expected result:
----------------
I would expect it to work same way as it does in a function defnition.

Actual result:
--------------
Parse error: parse error, expecting `T_FUNCTION' in foo.php on line 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-11 10:34 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is not supposed to work.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC