|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43958 class name added into the error message
Submitted: 2008-01-29 03:24 UTC Modified: 2008-09-02 09:46 UTC
Avg. Score:2.6 ± 1.2
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:2 (50.0%)
From: sv4php at fmethod dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
31 + 5 = ?
Subscribe to this entry?

 [2008-01-29 03:24 UTC] sv4php at fmethod dot com

Run the snippet. It should produce two warnings. But the include
function is inexplicably prefixed with my class name.

Reproduce code:
class MyClass 
	static public function loadCode($p) {
		return include $p;


Expected result:
Warning: include(file-which-does-not-exist-on-purpose.php) [function.include]: ...

Warning: include() [function.include]: ...

Actual result:
Warning: MyClass::include(file-which-does-not-exist-on-purpose.php) [function.MyClass-include]: ...

Warning: MyClass::include() [function.include]: ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-29 07:35 UTC]
Like due to namespaces... but that can only happen if you're running PHP 5.3. Did you fill in the wrong version?
 [2008-01-29 07:51 UTC] sv4php at fmethod dot com
Hi Derick, no, it's 5.2.5 stable official Win32 binary build, 100% (just made sure again).

PHP Version 5.2.5; Windows NT SV 5.1 build 2600; Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Also I believe I tested this with earlier 5.x builds and it was like that again, but I'm lazy to check again. Let me know if I have to, I can do that.

Also notice there's no namespace used or defined in the example (and the namespace is not "php", but my class name, which makes no sense to me).
 [2008-01-29 07:54 UTC]
I can not reproduce this btw....
 [2008-01-29 08:18 UTC] sv4php at fmethod dot com
Hi, I reproduced this on a 5.3 nightly just now (on XP), on 5.2.5 (on XP), and here's a live link to a 5.2.1 (on Linux, CentOS):

This is the same exact example, but I added phpversion() call.

Note for the archives: I'll remove this link in few days.
 [2008-01-29 08:50 UTC] jck_true at hotmail dot com
PHP Version 5.2.3
Build date: May 31 2007 09:36:39
Windows XP Profesional SP2

 [2008-01-29 11:30 UTC] kissifrot at gmail dot com
Reproduces with PHP 5.2.5 on Windows Vista too

PHP Version 5.2.5; Windows NT 6.0 build 6000; Zend Engine v2.2.0,
Copyright (c) 1998-2007 Zend Technologies

This happens with require function too
 [2008-02-01 22:32 UTC]
Exactly why it shouldn't print the class in which this happens?
 [2008-02-02 08:37 UTC] sv4php at fmethod dot com
'Exactly why it shouldn't print the class in which this happens?'

Four solid reasons:

1. Because running a method in the class is not the same as defining a method for the class.

2. Replace 'include $p' with 'file_get_contents($p)' above, it does NOT print the class (and it shouldn't).

3. If you have html_errors on, it prints a link that directs you to the manual for method "include" in class "MyClass", which doesn't exist.

4. For us wild experimenters, makes re-routing errors in error handlers less trivial, since the output is wrong...
 [2008-09-02 09:46 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 07:01:49 2024 UTC