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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 28 05:03:34 2022 UTC