Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001140 [Quercus] major always 05-22-06 14:11 05-22-06 16:19
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.0.20 Product Version 3.0.20
  Product Build
Summary 0001140: Defined constants aren't evaluated
Description PHP:

<?php
define(FOO, 1);
print FOO;
?>

Zend PHP prints "1". Quercus prints "FOO".
Steps To Reproduce
Additional Information 060522 snapshot
Attached Files

- Relationships

- Notes
(0001169)
koreth
05-22-06 14:36

This patch seems to fix it:

--- modules/quercus/src/com/caucho/quercus/env/Env.java- 2006-05-22 14:34:55.000000000 -0700
+++ modules/quercus/src/com/caucho/quercus/env/Env.java 2006-05-22 14:35:06.000000000 -0700
@@ -1712,14 +1712,14 @@
   {
     Value oldValue = _constMap.get(name);
 
- if (oldValue != null)
- return oldValue;
-
     _constMap.put(name, value);
 
     if (isCaseInsensitive)
       _lowerConstMap.put(name.toLowerCase(), value);
 
+ if (oldValue != null)
+ return oldValue;
+
     return value;
   }
 
(0001175)
ferg
05-22-06 16:19

php/0505

The patch isn't quite right because new define() does not override the old one. The bug is in the getConstant() which is defining FOO as "FOO" if FOO isn't defined already, i.e.

define("FOO", 1); would work but

define(FOO, 1); was treated as:

define("FOO", "FOO");
define("FOO", 1);
 

- Issue History
Date Modified Username Field Change
05-22-06 14:11 koreth New Issue
05-22-06 14:36 koreth Note Added: 0001169
05-22-06 16:19 ferg Note Added: 0001175
05-22-06 16:19 ferg Assigned To  => ferg
05-22-06 16:19 ferg Status new => closed
05-22-06 16:19 ferg Resolution open => fixed
05-22-06 16:19 ferg Fixed in Version  => 3.0.20


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker