php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18610 Name Space Issues / Reserved Words
Submitted: 2002-07-27 18:45 UTC Modified: 2002-09-09 12:29 UTC
From: ralph at _snarff dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.2 OS: Linux 2.4.18
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: ralph at _snarff dot net
New email:
PHP Version: OS:

 

 [2002-07-27 18:45 UTC] ralph at _snarff dot net
When using a class (more spifically) something like Date/Calc.php supplied with PEAR:  When I set a variable named "$this" before calling any class functions, it produces a warning.

example:
<?

include("Date/Calc.php");

$this = "some text";

echo Date_Calc::dateNow("%Y%m%d");

?>

Output:
--------
Warning: Problem with method call - please report this bug in <<FILENAME>> on line <<LINENUMBER>>
20020727

--------

As I am not familar with the Zend scripting engine, so this may be a bug in the rendering since it does produce only a warning, yet still operates.  But if it is not, then documentation on the word "this" should be located in the documentation in the following places:

http://www.php.net/manual/en/reserved.php#reserved.keywords

and again under:

http://www.php.net/manual/en/language.oop.php
(where $this is actually used)

Thanks,
Ralph Schindler


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-13 07:20 UTC] sander@php.net
I think this is a bug - not sure, though.
The warning only appears when calling a method from a non-instanciated object/class.

<?php
class foo {
    function foo() {
        echo "foo";
    }
}
$this = "foo";
foo::foo(); // warning
?>

Any Zend guru's that can clearify this?
 [2002-09-09 12:29 UTC] stas@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

However, touching $this is extremely un-recommended anyway.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 03 15:00:03 2025 UTC