php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23227 bug with ternary operator ? :
Submitted: 2003-04-15 08:17 UTC Modified: 2003-06-04 22:31 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: n dot manu at palina dot net Assigned: zeev (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-04-15 (dev) OS: Windows NT or XP
Private report: No CVE-ID: None
 [2003-04-15 08:17 UTC] n dot manu at palina dot net
Following script :

<?
$test = 1; 

if(((1 == $test)? true:false)){ // 
   echo 'ok'; 
} 
else{ // 
   echo 'probleme'; 
}

?>

causes the following error :

Parse error: parse error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in c:\program files\apache group\apache\htdocs\test_weber.php on line 4

--------------
With one of the following lines, there is no error :
if (((1 == $test)?true :false)){ //
if (((1 == $test)?true: false)){ // 
if (((1 == $test)?true : false)){ //

--------------
This error is not reproducible in with the latest release of php4 (4.3.2)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-15 11:02 UTC] joey@php.net
This is a valid bug. I think Zeev said he knows a fix for this?
 [2003-04-15 11:02 UTC] joey@php.net
This is a valid bug. I think Zeev said he knows a fix for this?
 [2003-04-15 14:09 UTC] colons at arebad dot com
I am thinking that if you edit Zend/zend_language_scanner.l on line 486 where it reads:

NAMESPACE_NAME ({LABEL}":")+{LABEL}

and just put it into

NAMESPACE_NAME {LABEL}

then problem will be getting fixed up.
 [2003-06-04 22:31 UTC] sterling@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:29 2024 UTC