#49281 [NEW]: Using . operator whilst assigning to a property gives misleading error.
From: RQuadling at GMail dot com
Operating system: Irrelevant
PHP version: 5.3SVN-2009-08-17 (snap)
PHP Bug Type: Feature/Change Request
Bug description: Using . operator whilst assigning to a property gives misleading error.
Description:
------------
Changeset http://svn.php.net/viewvc?view=revision&revision=286600.
The Config.php class is using . to create a property.
The error that is generated is appropriate, but I feel it is misleading.
The error is different under slightly different circumstances.
The 2 scripts below show what I mean.
Having said that, the elements being concatenated are constant, so I
believe there is some argument that these are NOT dynamic as say a
function call would be.
Reproduce code:
---------------
===== Test1.php =====
<?php
class Config {
public $string = __DIR__ . 'something';
}
?>
===== Test2.php =====
<?php
class Config {
public $array = array(__DIR__ . 'something');
}
Expected result:
----------------
An error along the lines that you cannot assign dynamic values to
properties during class creation.
Actual result:
--------------
===== Test1.php =====
Parse error: parse error, expecting ','' or ';'' in
Z:\Test1.php on
line 3
===== Test2.php =====
Parse error: parse error, expecting `')'' in Z:\Test2.php on line 3
--
Edit bug report at http://bugs.php.net/?id=49281&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49281&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49281&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49281&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49281&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49281&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49281&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49281&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49281&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49281&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49281&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49281&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49281&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49281&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49281&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49281&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49281&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49281&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49281&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49281&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49281&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49281&r=mysqlcfg
Thread (2 messages)
- RQuadling at GMail dot com