php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #29703 Function to determine if a method is called statically
Submitted: 2004-08-16 12:16 UTC Modified: 2004-08-17 20:40 UTC
From: tip at tut dot by Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.9RC1 OS:
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: tip at tut dot by
New email:
PHP Version: OS:

 

 [2004-08-16 12:16 UTC] tip at tut dot by
Description:
------------
Sometimes it is very convenient to use method from a class statically, but while implementing such a function there's no way to determine how this function is used.

executing this line from a static method call returns 1
print_r(isset($this));

while operations with is_object($this), gettype($this) etc. results in PHP Notice:  Undefined variable:  this in c:\httpd\.php\pear\File\Find.php on line 198



Reproduce code:
---------------
// executed from static method call
print_r(isset($this));

Expected result:
----------------
FALSE

Actual result:
--------------
1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-16 12:32 UTC] tip at tut dot by
Sorry. Found a bug in my own sources. =\

It was unhandled echo call few lines above
echo


print_r(isset($this));
 [2004-08-16 12:32 UTC] tip at tut dot by
Sorry. Found a bug in my own sources. =\

It was unhandled echo call few lines above
echo


print_r(isset($this));
 [2004-08-17 20:40 UTC] magnus@php.net
Not a bug 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC