From:
Operating system: windows 7
PHP version: 5.3.3
Package: *General Issues
Bug Type: Bug
Bug description:get_class(NULL) returns class name when called insid member
function of a class
Description:
------------
get_class(NULL) returns class name when called inside member function of a
class.
<?php
CLASS foo {
public static function bar() {
echo get_class(NULL);
}
public function baz() {
echo get_class(NULL);
}
}
foo::bar();
echo "<br>";
$f = new foo();
$f->baz();
?>
output:
foo
foo
Expected output:
Warning: get_class() called without object from outside a class in
filename.php
on line 4
Warning: get_class() called without object from outside a class in
filename.php
on line 7
-------Message--------
When some string/int is sent an expected output is produced that is a
warning
message.
I am using EasyPHP 5.3.3. This error does not exists in PHP 5.2.6
----------------------
------phpinfo()------- [just first table]
System Windows NT RAHUL-PC 6.1 build 7600 (Unknow Windows version Ultimate
Edition) i586
Build Date Jul 21 2010 20:00:47
Compiler MSVC6 (Visual C++ 6.0)
Architecture x86
Configure Command cscript /nologo configure.js "--enable-snapshot-build"
"--disable-isapi" "--enable-debug-pack" "--disable-isapi" "--without-mssql"
"--
without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=D:\php-
sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-
sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-
sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/"
"--
enable-com-dotnet" "--with-mcrypt=static"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File D:\EasyPHP\apache\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,TS,VC6
PHP Extension Build API20090626,TS,VC6
Debug Build no
Thread Safety enabled
Zend Memory Manager enabled
Zend Multibyte Support disabled
IPv6 Support enabled
Registered PHP Streams php, file, glob, data, http, ftp, zip,
compress.zlib,
compress.bzip2, phar
Registered Stream Socket Transports tcp, udp
Registered Stream Filters convert.iconv.*, mcrypt.*, mdecrypt.*,
string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*,
consumed, dechunk, zlib.*, bzip2.*
Test script:
---------------
<?php
CLASS foo {
public static function bar() {
echo get_class(NULL);
}
public function baz() {
echo get_class(NULL);
}
}
foo::bar();
echo "<br>";
$f = new foo();
$f->baz();
?>
Expected result:
----------------
Warning: get_class() called without object from outside a class in
filename.php on
line 4
Warning: get_class() called without object from outside a class in
filename.php on
line 7
Actual result:
--------------
foo
foo
--
Edit bug report at http://bugs.php.net/bug.php?id=52605&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52605&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52605&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52605&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52605&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52605&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52605&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52605&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52605&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52605&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52605&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52605&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52605&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52605&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52605&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52605&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52605&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52605&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52605&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52605&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52605&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52605&r=mysqlcfg