From: php at kfee-programming dot com
Operating system: Debian GNU/Linux 6.0
PHP version: 5.3.20
Package: Compile Failure
Bug Type: Feature/Change Request
Bug description:Parser should recognize objects within parenthesis
Description:
------------
Placing any object within parentheses and attempting to access members of
that
object causes the parser to fail with an error. This makes chaining
difficult,
particularly with clones.
One would expect that parenthesis should have no effect
on the identity of the variable or expression they are surrounding, but
this
failure of the parser causes a change in identity to not-an-object.
This was reported as a bug #30533, but was declared NAB with no additional
reasoning. This is thus a change request.
Test script:
---------------
<?php
$Now = new \DateTime();
$OneSecAgo = (clone $Now)->sub(new \DateInterval("PT1S"));
//Or $OneSecAgo = clone($Now)->sub(new \DateInterval("PT1S"));
//Neither work.
echo $Now->format("c") , "\n" , $OneSecAgo->format("c");
Expected result:
----------------
2013-01-09T17:01:35-08:00
2013-01-09T17:01:34-08:00
Actual result:
--------------
[Wed Jan 09 17:01:35 2013] [error] [client *.*.*.*] PHP Parse error:
syntax
error, unexpected T_OBJECT_OPERATOR in /var/www/test.php on line 3
--
Edit bug report at https://bugs.php.net/bug.php?id=63954&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63954&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63954&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63954&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63954&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63954&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63954&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63954&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63954&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63954&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63954&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63954&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63954&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63954&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63954&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63954&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63954&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63954&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63954&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63954&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63954&r=mysqlcfg