ID:               30837
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jordi at jcanals dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows XP Pro
 PHP Version:      5.0.2
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of #30820.


Previous Comments:
------------------------------------------------------------------------

[2004-11-19 14:56:09] jordi at jcanals dot net

Description:
------------
If you assign a static property by using the $this->varname operator,
then the engine creates a new class property called $this->varname
instead of reporting an E_STRICT warning.

This can insert some bugs to the code, as the property is defined as
public static, and no errors nor warnings are reported when referencing
the variable using the arrow operator.

I think that if error_reporting is set to E_ALL | E_STRICT, an strict
error should be received.

To test this, I have in my PHP.INI the following parameters:

error_reporting = E_ALL | E_STRICT
display_errors = On
zend.ze1_compatibility_mode = Off


Reproduce code:
---------------
<?php
error_reporting(E_ALL | E_STRICT);

class staticMethods
{
        
        public static $myvar;
        
        public function __construct()
        {
                $this->myvar = 'Test';
                self::$myvar = 'Whats Up?';
        }
        
        public function showMyVar()
        {
                echo '<br>Here myvar: ', self::$myvar;
                echo '<br>Other myvar: ', $this->myvar;
        }
}

$myclass = new staticMethods();
$myclass->showMyVar();

?>


Expected result:
----------------
You can see that error_reporting is set to E_ALL | E_STRICT, and no
errors nor warnings are reported.

I think it shoud report an E_STRICT warning when the myvar property is
assigned by $this->myvar (in the sample's constructor)

What it's done is created a new myvar property and assigned the value
to it.

Actual result:
--------------
Running this script the output is:

Here myvar: Whats Up?
Other myvar: Test

And no warnings, errors or notices are reported.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30837&edit=1

Reply via email to