Bug #62342 [Opn->Nab]: self:$var - PHP should produce an error
Edit report at https://bugs.php.net/bug.php?id=62342&edit=1
ID: 62342
Updated by: nikic@php.net
Reported by: 007not at gmail dot com
Summary: self:$var - PHP should produce an error
-Status: Open
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: win, linux
PHP Version: 5.4Git-2012-06-17 (snap)
Block user comment: N
Private report: N
New Comment:
self: creates a goto label with name "self". You could write that line as
self:
$var = $newvar;
So the code is perfectly valid.
Previous Comments:
------------------------------------------------------------------------
[2012-06-17 14:42:35] 007not at gmail dot com
Description:
------------
Take a good look in the code, a special attention to : at line 10. I think that PHP should produce
an error in this line.
Test script:
---------------
<?php
class test
{
static $var = 0;
static function run()
{
$var = 1;
$newvar = 2;
self:$var = $newvar; //where is error?! this is line 10
echo $var . PHP_EOL;
echo self::$var . PHP_EOL;
//echo self:$var; //rise error!
}
}
test::run();
Expected result:
----------------
an error in line 10
Actual result:
--------------
2
0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62342&edit=1
Thread (2 messages)