php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20058 include not allowed within class definition
Submitted: 2002-10-24 07:25 UTC Modified: 2002-10-24 07:27 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ernest at vogelsinger dot at Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.2.2 OS: RHL 7.2
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: ernest at vogelsinger dot at
New email:
PHP Version: OS:

 

 [2002-10-24 07:25 UTC] ernest at vogelsinger dot at
It appears as if "include()" and "require()" cannot appear inside a class definition, but outside a class method.

For example, the construct
	class A {
		include ('class_a_methods.php');
	}
returns an error (unexpected T_INCLUDE), but
	class A {
		function foo() {
			include ('class_a_foo_method.php');
		}
	}
works as expected.

This is a slight annoyance if one wants to keep class code in manageable chunks. Please add this feature in an upcoming version!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-24 07:27 UTC] derick@php.net
This has come up before on several occasions, and it was decided not to implement is. (Although I would like to see this kind od functionality too). You can try to write to engine2@lists.zend.com to show your support for this though.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 10:01:28 2024 UTC