[PHP-CVS-DAILY] cvs: php-src / ChangeLog

2003-11-17 Thread changelog
changelog   Mon Nov 17 20:34:37 2003 EDT

  Modified files:  
/php-srcChangeLog 
  Log:
  ChangeLog update
  
Index: php-src/ChangeLog
diff -u php-src/ChangeLog:1.1450 php-src/ChangeLog:1.1451
--- php-src/ChangeLog:1.1450Sun Nov 16 20:31:45 2003
+++ php-src/ChangeLog   Mon Nov 17 20:34:35 2003
@@ -1,3 +1,81 @@
+2003-11-17  Frank M. Kromann  [EMAIL PROTECTED]
+
+* ext/mssql/php_mssql.c:
+  MFB: Fix for bug #25817
+  Check for a return value from a stored procedure right after fetching rows
+  Replace code with some Z_ macros
+
+* (PHP_4_3)
+  ext/mssql/php_mssql.c:
+  Fix for bug #25817
+  Check for a return value from a stored procedure right after fetching rows
+
+2003-11-17  Jani Taskinen  [EMAIL PROTECTED]
+
+* (PHP_4_3)
+  NEWS
+  ext/tokenizer/Makefile.frag:
+  MFH: - Fixed bug #26253 (ext/tokenizer: build as shared extension fails)
+
+* ext/tokenizer/Makefile.frag:
+  - Fixed bug #26253 (ext/tokenizer: build as shared extension fails)
+
+2003-11-17  Sebastian Bergmann  [EMAIL PROTECTED]
+
+* sapi/servlet/.cvsignore
+  sapi/servlet/CREDITS
+  sapi/servlet/EXPERIMENTAL
+  sapi/servlet/Makefile.frag
+  sapi/servlet/README
+  sapi/servlet/config.m4
+  sapi/servlet/cookies.php
+  sapi/servlet/date.php
+  sapi/servlet/formatter.java
+  sapi/servlet/jinfo.php
+  sapi/servlet/jver.php
+  sapi/servlet/reqheaders.php
+  sapi/servlet/reqinfo.php
+  sapi/servlet/reqparams.php
+  sapi/servlet/servlet.c
+  sapi/servlet/servlet.dsp
+  sapi/servlet/servlet.java
+  sapi/servlet/sessions.php
+  sapi/servlet/web.xml:
+  SAPI/Servlet has been moved to PECL.
+
+2003-11-17  Martin Jansen  [EMAIL PROTECTED]
+
+* pear/PEAR/Command/Remote.php:
+  - Fix potential warning
+
+2003-11-17  Greg Beaver  [EMAIL PROTECTED]
+
+* pear/PEAR/Installer.php:
+  necessary refinement
+
+* pear/package-PEAR.xml
+  pear/PEAR/Installer.php:
+  fix bug #248, --force does not work as expected
+
+* pear/package-PEAR.xml
+  pear/PEAR/Installer.php:
+  fix bug #249
+
+2003-11-17  Ilia Alshanetsky  [EMAIL PROTECTED]
+
+* ext/curl/streams.c:
+  Silence warning.
+
+2003-11-17  Stig Bakken  [EMAIL PROTECTED]
+
+* pear/Archive/Tar.php:
+  - chmod +x when extracting archived executable files
+
+2003-11-17  Marcus Boerger  [EMAIL PROTECTED]
+
+* ZendEngine2/zend_interfaces.c:
+  Correct destruction
+
 2003-11-16  Ilia Alshanetsky  [EMAIL PROTECTED]
 
 * ext/sqlite/CREDITS:


[PHP-CVS] cvs: php-src /sapi/servlet .cvsignore CREDITS EXPERIMENTAL Makefile.frag README config.m4 cookies.php date.php formatter.java jinfo.php jver.php reqheaders.php reqinfo.php reqparams.php servlet.c servlet.dsp servlet.java sessions.php web.xml

2003-11-17 Thread Sebastian Bergmann
sebastian   Mon Nov 17 11:48:44 2003 EDT

  Removed files:   
/php-src/sapi/servlet   .cvsignore CREDITS EXPERIMENTAL Makefile.frag 
README config.m4 cookies.php date.php 
formatter.java jinfo.php jver.php 
reqheaders.php reqinfo.php reqparams.php 
servlet.c servlet.dsp servlet.java 
sessions.php web.xml 
  Log:
  SAPI/Servlet has been moved to PECL.
  

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/tokenizer Makefile.frag

2003-11-17 Thread Jani Taskinen
sniper  Mon Nov 17 14:31:18 2003 EDT

  Modified files:  
/php-src/ext/tokenizer  Makefile.frag 
  Log:
  - Fixed bug #26253 (ext/tokenizer: build as shared extension fails)
  
Index: php-src/ext/tokenizer/Makefile.frag
diff -u php-src/ext/tokenizer/Makefile.frag:1.1 php-src/ext/tokenizer/Makefile.frag:1.2
--- php-src/ext/tokenizer/Makefile.frag:1.1 Thu Apr  4 13:15:52 2002
+++ php-src/ext/tokenizer/Makefile.frag Mon Nov 17 14:31:17 2003
@@ -1 +1 @@
-$(builddir)/tokenizer.lo: Zend/zend_language_parser.h
+$(builddir)/tokenizer.lo: $(builddir)/../../Zend/zend_language_parser.h

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/tokenizer Makefile.frag

2003-11-17 Thread Jani Taskinen
sniper  Mon Nov 17 14:32:05 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/tokenizer  Makefile.frag 
  Log:
  MFH: - Fixed bug #26253 (ext/tokenizer: build as shared extension fails)
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.469 php-src/NEWS:1.1247.2.470
--- php-src/NEWS:1.1247.2.469   Thu Nov 13 19:32:30 2003
+++ php-src/NEWSMon Nov 17 14:32:03 2003
@@ -3,6 +3,7 @@
 ?? ??? 2003, Version 4.3.5
 - Fixed header handler in NSAPI SAPI module (header-replace was ignored,
   send_default_content_type now sends value from php.ini). (Uwe Schindler)
+- Fixed bug #26253 (ext/tokenizer: build as shared extension fails). (Jani)
 - Fixed bug #26235 (yp_first/yp_next do not specify correct key length). (Ilia)
 - Fixed bug #26216 (getimagesize(): stream does not support seeking when
   using remote files). (Marcus)
Index: php-src/ext/tokenizer/Makefile.frag
diff -u php-src/ext/tokenizer/Makefile.frag:1.1 
php-src/ext/tokenizer/Makefile.frag:1.1.4.1
--- php-src/ext/tokenizer/Makefile.frag:1.1 Thu Apr  4 13:15:52 2002
+++ php-src/ext/tokenizer/Makefile.frag Mon Nov 17 14:32:05 2003
@@ -1 +1 @@
-$(builddir)/tokenizer.lo: Zend/zend_language_parser.h
+$(builddir)/tokenizer.lo: $(builddir)/../../Zend/zend_language_parser.h

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /ext/mssql php_mssql.c

2003-11-17 Thread Frank M. Kromann
fmk Mon Nov 17 15:53:29 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/ext/mssql  php_mssql.c 
  Log:
  Fix for bug #25817
  Check for a return value from a stored procedure right after fetching rows
  
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.86.2.25 php-src/ext/mssql/php_mssql.c:1.86.2.26
--- php-src/ext/mssql/php_mssql.c:1.86.2.25 Tue Oct 14 23:32:18 2003
+++ php-src/ext/mssql/php_mssql.c   Mon Nov 17 15:53:28 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.86.2.25 2003/10/15 03:32:18 iliaa Exp $ */
+/* $Id: php_mssql.c,v 1.86.2.26 2003/11/17 20:53:28 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -1061,6 +1061,9 @@
result-lastresult = retvalue;
}
efree(column_types);
+   if (result-statement) {
+   _mssql_get_sp_result(mssql_ptr, result-statement TSRMLS_CC);
+   }
return i;
 }
 
@@ -1788,9 +1791,6 @@
RETURN_FALSE;
}
else if (retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS) {
-   if (result-statement) {
-   _mssql_get_sp_result(result-mssql_ptr, result-statement 
TSRMLS_CC);
-   }
RETURN_FALSE;
}
else {
@@ -2120,11 +2120,8 @@
result-num_fields = num_fields;
 
result-fields = (mssql_field *) 
emalloc(sizeof(mssql_field)*num_fields);
-   result-num_rows = _mssql_fetch_batch(mssql_ptr, 
result, retvalue TSRMLS_CC);
result-statement = statement;
-   }
-   else {
-   _mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);
+   result-num_rows = _mssql_fetch_batch(mssql_ptr, 
result, retvalue TSRMLS_CC);
}
}
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/mssql php_mssql.c

2003-11-17 Thread Frank M. Kromann
fmk Mon Nov 17 15:56:54 2003 EDT

  Modified files:  
/php-src/ext/mssql  php_mssql.c 
  Log:
  MFB: Fix for bug #25817
  Check for a return value from a stored procedure right after fetching rows
  Replace code with some Z_ macros
  
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.124 php-src/ext/mssql/php_mssql.c:1.125
--- php-src/ext/mssql/php_mssql.c:1.124 Tue Oct 14 23:31:29 2003
+++ php-src/ext/mssql/php_mssql.c   Mon Nov 17 15:56:53 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_mssql.c,v 1.124 2003/10/15 03:31:29 iliaa Exp $ */
+/* $Id: php_mssql.c,v 1.125 2003/11/17 20:56:53 fmk Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -775,8 +775,7 @@
case SQLINT2:
case SQLINT4:
case SQLINTN: { 
-   Z_LVAL_P(result) = (long) anyintcol(offset);
-   Z_TYPE_P(result) = IS_LONG;
+   ZVAL_LONG(result, (long) anyintcol(offset));
break;
} 
case SQLCHAR:
@@ -791,18 +790,14 @@
length--;
}
 #endif
-   Z_STRVAL_P(result) = estrndup(data,length);
-   Z_STRLEN_P(result) = length;
-   Z_TYPE_P(result) = IS_STRING;
+   ZVAL_STRINGL(result, data, length, 1); 
break;
}
case SQLFLT4:
-   Z_DVAL_P(result) = (double) floatcol4(offset);
-   Z_TYPE_P(result) = IS_DOUBLE;
+   ZVAL_DOUBLE(result, (double) floatcol4(offset));
break;
case SQLFLT8:
-   Z_DVAL_P(result) = (double) floatcol8(offset);
-   Z_TYPE_P(result) = IS_DOUBLE;
+   ZVAL_DOUBLE(result, (double) floatcol8(offset));
break;
 #ifdef SQLUNIQUE
case SQLUNIQUE: {
@@ -824,9 +819,7 @@
bin = ((DBBINARY *)dbdata(mssql_ptr-link, offset));
memcpy(res_buf,bin,res_length);
res_buf[res_length] = '\0';
-   Z_STRLEN_P(result) = res_length;
-   Z_STRVAL_P(result) = res_buf;
-   Z_TYPE_P(result) = IS_STRING;
+   ZVAL_STRINGL(result, res_buf, res_length, 0);
}
break;
case SQLNUMERIC:
@@ -858,9 +851,7 @@
sprintf(res_buf, %d-%02d-%02d %02d:%02d:%02d 
, dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, 
dateinfo.second);
}

-   Z_STRVAL_P(result) = res_buf;
-   Z_STRLEN_P(result) = res_length;
-   Z_TYPE_P(result) = IS_STRING;
+   ZVAL_STRINGL(result, res_buf, res_length, 0);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, column %d 
has unknown data type (%d), offset, coltype(offset));
ZVAL_FALSE(result);
@@ -887,9 +878,7 @@
bin = ((DBBINARY *)dbdata(mssql_ptr-link, offset));
memcpy(res_buf, bin, res_length);
res_buf[res_length] = '\0';
-   Z_STRLEN_P(result) = res_length;
-   Z_STRVAL_P(result) = res_buf;
-   Z_TYPE_P(result) = IS_STRING;
+   ZVAL_STRINGL(result, res_buf, res_length, 0);
}
else if  (dbwillconvert(coltype(offset),SQLCHAR)) {
unsigned char *res_buf;
@@ -919,9 +908,7 @@
sprintf(res_buf, %d-%02d-%02d %02d:%02d:%02d , 
dateinfo.year, dateinfo.month, dateinfo.day, dateinfo.hour, dateinfo.minute, 
dateinfo.second);
}
 
-   Z_STRVAL_P(result) = res_buf;
-   Z_STRLEN_P(result) = res_length;
-   Z_TYPE_P(result) = IS_STRING;
+   ZVAL_STRINGL(result, res_buf, res_length, 0);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, column %d has unknown 
data type (%d), offset, coltype(offset));
ZVAL_FALSE(result);
@@ -1063,6 +1050,9 @@
result-lastresult = retvalue;
}
efree(column_types);
+   if (result-statement) {
+   _mssql_get_sp_result(mssql_ptr, result-statement TSRMLS_CC);
+   }
return i;
 }
 
@@ -1632,9 +1622,7 @@
RETURN_FALSE;
}
 
-   Z_STRVAL_P(return_value) = estrdup(result-fields[field_offset].name);
-   Z_STRLEN_P(return_value) = strlen(result-fields[field_offset].name);
-   Z_TYPE_P(return_value) = IS_STRING;

[PHP-CVS] cvs: php-src /win32 install.txt

2003-11-17 Thread Jani Taskinen
sniper  Mon Nov 17 19:06:38 2003 EDT

  Modified files:  
/php-src/win32  install.txt 
  Log:
  fix the docs
  
Index: php-src/win32/install.txt
diff -u php-src/win32/install.txt:1.25 php-src/win32/install.txt:1.26
--- php-src/win32/install.txt:1.25  Wed Nov  5 03:33:46 2003
+++ php-src/win32/install.txt   Mon Nov 17 19:06:37 2003
@@ -277,7 +277,7 @@
   following lines to your httpd.conf:
 
LoadModule php5_module c:/php/sapi/php4apache.dll
-   AddModule mod_php4.c
+   AddModule mod_php5.c
AddType application/x-httpd-php .php
 
   Note: Especially newer versions of Apache do not need the

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard math.c /ext/standard/tests/math bug25694.phpt

2003-11-17 Thread Ilia Alshanetsky
iliaa   Mon Nov 17 21:50:42 2003 EDT

  Added files: 
/php-src/ext/standard/tests/mathbug25694.phpt 

  Modified files:  
/php-src/ext/standard   math.c 
  Log:
  Fixed Bug #25694 (round() and number_format() give inconsistent results).
  
  
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.108 php-src/ext/standard/math.c:1.109
--- php-src/ext/standard/math.c:1.108   Sun Oct  5 04:08:49 2003
+++ php-src/ext/standard/math.c Mon Nov 17 21:50:40 2003
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: math.c,v 1.108 2003/10/05 08:08:49 zeev Exp $ */
+/* $Id: math.c,v 1.109 2003/11/18 02:50:40 iliaa Exp $ */
 
 #include php.h
 #include php_math.h
@@ -40,6 +40,18 @@
 # endif
 #endif
 
+#define PHP_ROUND_WITH_FUZZ(val, places) { \
+   double tmp_val=val, f = pow(10.0, (double) places); \
+   tmp_val *= f;   \
+   if (tmp_val = 0.0) {   \
+   tmp_val = floor(tmp_val + PHP_ROUND_FUZZ);  \
+   } else {\
+   tmp_val = ceil(tmp_val - PHP_ROUND_FUZZ);   \
+   }   \
+   tmp_val /= f;   \
+   val = !zend_isnan(tmp_val) ? tmp_val : val; \
+}  \
+
 /* {{{ proto int abs(int number)
Return the absolute value of the number */
 
@@ -121,7 +133,7 @@
 {
zval **value, **precision;
int places = 0;
-   double f, return_val;
+   double return_val;

if (ZEND_NUM_ARGS()  1 || ZEND_NUM_ARGS()  2 ||
zend_get_parameters_ex(ZEND_NUM_ARGS(), value, precision) == 
FAILURE) {
@@ -147,14 +159,7 @@
return_val = (Z_TYPE_PP(value) == IS_LONG) ?
(double)Z_LVAL_PP(value) : 
Z_DVAL_PP(value);
 
-   f = pow(10.0, (double) places);
-
-   return_val *= f;
-   if (return_val = 0.0)
-   return_val = floor(return_val + PHP_ROUND_FUZZ);
-   else
-   return_val = ceil(return_val - PHP_ROUND_FUZZ);
-   return_val /= f;
+   PHP_ROUND_WITH_FUZZ(return_val, places);
 
RETURN_DOUBLE(return_val);
break;
@@ -995,13 +1000,15 @@
int tmplen, reslen=0;
int count=0;
int is_negative=0;
-   
+
if (d  0) {
is_negative = 1;
d = -d;
}
dec = MAX(0, dec);
 
+   PHP_ROUND_WITH_FUZZ(d, dec);
+
tmplen = spprintf(tmpbuf, 0, %.*f, dec, d);
 
if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) {

Index: php-src/ext/standard/tests/math/bug25694.phpt
+++ php-src/ext/standard/tests/math/bug25694.phpt
--TEST--
Bug #25694 (round() and number_format() inconsistency)
--FILE--
?php
echo round 0.045 =  . round(0.045, 2) . \n;
echo number format 0.045 =  . number_format(0.045, 2) . \n\n;
echo round 0.055 =  . round(0.055, 2) . \n;
echo number format 0.055 =  . number_format(0.055, 2) . \n\n;
echo round 5.045 =  . round(5.045, 2) . \n;
echo number format 5.045 =  . number_format(5.045, 2) . \n\n;
echo round 5.055 =  . round(5.055, 2) . \n;
echo number format 5.055 =  . number_format(5.055, 2) . \n\n;
echo round 3.025 =  . round(3.025, 2) . \n;
echo number format 3.025 =  . number_format(3.025, 2) . \n\n;
echo round 4.025 =  . round(4.025, 2) . \n;
echo number format 4.025 =  . number_format(4.025, 2) . \n\n;
?
--EXPECT--
round 0.045 = 0.05
number format 0.045 = 0.05

round 0.055 = 0.06
number format 0.055 = 0.06

round 5.045 = 5.05
number format 5.045 = 5.05

round 5.055 = 5.06
number format 5.055 = 5.06

round 3.025 = 3.03
number format 3.025 = 3.03

round 4.025 = 4.03
number format 4.025 = 4.03

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard math.c /ext/standard/tests/math bug25694.phpt

2003-11-17 Thread Ilia Alshanetsky
iliaa   Mon Nov 17 21:50:52 2003 EDT

  Added files: (Branch: PHP_4_3)
/php-src/ext/standard/tests/mathbug25694.phpt 

  Modified files:  
/php-src/ext/standard   math.c 
/php-srcNEWS 
  Log:
  MFH: Fixed Bug #25694 (round() and number_format() give inconsistent 
  results).
  
  
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.97.2.7 php-src/ext/standard/math.c:1.97.2.8
--- php-src/ext/standard/math.c:1.97.2.7Thu Aug 28 12:01:49 2003
+++ php-src/ext/standard/math.c Mon Nov 17 21:50:49 2003
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: math.c,v 1.97.2.7 2003/08/28 16:01:49 sas Exp $ */
+/* $Id: math.c,v 1.97.2.8 2003/11/18 02:50:49 iliaa Exp $ */
 
 #include php.h
 #include php_math.h
@@ -40,6 +40,18 @@
 # endif
 #endif
 
+#define PHP_ROUND_WITH_FUZZ(val, places) { \
+   double tmp_val=val, f = pow(10.0, (double) places); \
+   tmp_val *= f;   \
+   if (tmp_val = 0.0) {   \
+   tmp_val = floor(tmp_val + PHP_ROUND_FUZZ);  \
+   } else {\
+   tmp_val = ceil(tmp_val - PHP_ROUND_FUZZ);   \
+   }   \
+   tmp_val /= f;   \
+   val = !zend_isnan(tmp_val) ? tmp_val : val; \
+}  \
+
 /* {{{ proto int abs(int number)
Return the absolute value of the number */
 
@@ -121,7 +133,7 @@
 {
zval **value, **precision;
int places = 0;
-   double f, return_val;
+   double return_val;

if (ZEND_NUM_ARGS()  1 || ZEND_NUM_ARGS()  2 ||
zend_get_parameters_ex(ZEND_NUM_ARGS(), value, precision) == 
FAILURE) {
@@ -147,14 +159,7 @@
return_val = (Z_TYPE_PP(value) == IS_LONG) ?
(double)Z_LVAL_PP(value) : 
Z_DVAL_PP(value);
 
-   f = pow(10.0, (double) places);
-
-   return_val *= f;
-   if (return_val = 0.0)
-   return_val = floor(return_val + PHP_ROUND_FUZZ);
-   else
-   return_val = ceil(return_val - PHP_ROUND_FUZZ);
-   return_val /= f;
+   PHP_ROUND_WITH_FUZZ(return_val, places);
 
RETURN_DOUBLE(return_val);
break;
@@ -995,13 +1000,15 @@
int tmplen, reslen=0;
int count=0;
int is_negative=0;
-   
+
if (d  0) {
is_negative = 1;
d = -d;
}
dec = MAX(0, dec);
 
+   PHP_ROUND_WITH_FUZZ(d, dec);
+
tmplen = spprintf(tmpbuf, 0, %.*f, dec, d);
 
if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) {
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.470 php-src/NEWS:1.1247.2.471
--- php-src/NEWS:1.1247.2.470   Mon Nov 17 14:32:03 2003
+++ php-src/NEWSMon Nov 17 21:50:50 2003
@@ -29,6 +29,8 @@
 - Fixed bug #26003 (Make fgetcsv() binary safe). (Ilia, Moriyoshi)
 - Fixed bug #25794 (Cannot open existing hash db3 file with write ext/dba).
   (Marcus)
+- Fixed Bug #25694 (round() and number_format() give inconsistent results).
+  (Ilia)
 - Fixed bug #25581 (getimagesize () return incorrect values on bitmap
   (os2) files). (Marcus)
 

Index: php-src/ext/standard/tests/math/bug25694.phpt
+++ php-src/ext/standard/tests/math/bug25694.phpt
--TEST--
Bug #25694 (round() and number_format() inconsistency)
--FILE--
?php
echo round 0.045 =  . round(0.045, 2) . \n;
echo number format 0.045 =  . number_format(0.045, 2) . \n\n;
echo round 0.055 =  . round(0.055, 2) . \n;
echo number format 0.055 =  . number_format(0.055, 2) . \n\n;
echo round 5.045 =  . round(5.045, 2) . \n;
echo number format 5.045 =  . number_format(5.045, 2) . \n\n;
echo round 5.055 =  . round(5.055, 2) . \n;
echo number format 5.055 =  . number_format(5.055, 2) . \n\n;
echo round 3.025 =  . round(3.025, 2) . \n;
echo number format 3.025 =  . number_format(3.025, 2) . \n\n;
echo round 4.025 =  . round(4.025, 2) . \n;
echo number format 4.025 =  . number_format(4.025, 2) . \n\n;
?
--EXPECT--
round 0.045 = 0.05
number format 0.045 = 0.05

round 0.055 = 0.06
number format 0.055 = 0.06

round 5.045 = 5.05
number format 5.045 = 5.05

round 5.055 = 5.06
number format 5.055 = 5.06

round 3.025 = 3.03
number format 3.025 = 3.03

round 4.025 = 4.03
number format 4.025 = 4.03

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard parsedate.y

2003-11-17 Thread Hartmut Holzgraefe
hholzgraTue Nov 18 01:45:03 2003 EDT

  Modified files:  
/php-src/ext/standard   parsedate.y 
  Log:
  make strtotime() understand the datetime format used with XML Schema
  
  
Index: php-src/ext/standard/parsedate.y
diff -u php-src/ext/standard/parsedate.y:1.43 php-src/ext/standard/parsedate.y:1.44
--- php-src/ext/standard/parsedate.y:1.43   Tue Nov 11 21:55:03 2003
+++ php-src/ext/standard/parsedate.yTue Nov 18 01:45:01 2003
@@ -8,7 +8,7 @@
 **  This code is in the public domain and has no copyright.
 */
 
-/* $Id: parsedate.y,v 1.43 2003/11/12 02:55:03 iliaa Exp $ */
+/* $Id: parsedate.y,v 1.44 2003/11/18 06:45:01 hholzgra Exp $ */
 
 #include php.h
 
@@ -136,6 +136,7 @@
int yyRelMonth;
int yyRelSeconds;
int yyRelYear;
+   int yyFlag;
 };
 
 typedef union _date_ll {
@@ -150,30 +151,30 @@
 
 %}
 
-/* This grammar has 17 shift/reduce conflicts. */
-%expect 17
+/* This grammar has 19 shift/reduce conflicts. */
+%expect 19
 %pure_parser
 
-%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID
+%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID tTZONE tZZONE 
 %token tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
 %token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
 
 %type  NumbertDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tMINUTE_UNIT
 %type  NumbertMONTH tMONTH_UNIT
-%type  NumbertSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
+%type  NumbertSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE tTZONE tZZONE 
 %type  Meridian  tMERIDIAN o_merid
 
 %%
 
 spec   : /* NULL */
| spec item
-   ;
+;
 
 item   : time {
((struct date_yy *)parm)-yyHaveTime++;
}
| zone {
-   ((struct date_yy *)parm)-yyHaveZone++;
+   ((struct date_yy *)parm)-yyHaveZone++;
}
| date {
((struct date_yy *)parm)-yyHaveDate++;
@@ -251,7 +252,26 @@
| /* empty */
;
 
-zone   : tZONE {
+   /* we have to deal with a special case for the datetime format 
+  of XML Schema here: '2003-11-18T22:40:00Z'
+  the combination of a 'T' timezone specifier later followed
+  by a 'Z' is now recognized and allowed
+  TODO: change the grammer so that the exact positions are checked
+  right now '2003-11-18 22:40:00 TZ' is also accepted (hartmut)
+   */
+  
+zone   : tTZONE {
+   ((struct date_yy *)parm)-yyFlag = 1;
+   ((struct date_yy *)parm)-yyTimezone = $1;
+   }
+   | tZZONE {
+   if (((struct date_yy *)parm)-yyFlag) {
+   ((struct date_yy *)parm)-yyHaveZone--;
+   ((struct date_yy *)parm)-yyFlag = 0;
+   }
+   ((struct date_yy *)parm)-yyTimezone = $1;
+   }
+   | tZONE {
((struct date_yy *)parm)-yyTimezone = $1;
}
| tDAYZONE {
@@ -659,13 +679,13 @@
 { q, tZONE,  HOUR (- 4) },
 { r, tZONE,  HOUR (- 5) },
 { s, tZONE,  HOUR (- 6) },
-{ t, tZONE,  HOUR (- 7) },
+{ t, tTZONE, HOUR (- 7) },
 { u, tZONE,  HOUR (- 8) },
 { v, tZONE,  HOUR (- 9) },
 { w, tZONE,  HOUR (-10) },
 { x, tZONE,  HOUR (-11) },
 { y, tZONE,  HOUR (-12) },
-{ z, tZONE,  HOUR (  0) },
+{ z, tZZONE, HOUR (  0) },
 { NULL, 0, 0 }
 };
 
@@ -969,6 +989,7 @@
   date.yyHaveRel = 0;
   date.yyHaveTime = 0;
   date.yyHaveZone = 0;
+  date.yyFlag = 0;
 
   if (yyparse ((void *)date)
   || date.yyHaveTime  1 || date.yyHaveZone  1 
@@ -1050,6 +1071,7 @@
   if (!gmt)
return -1;
   delta = date.yyTimezone * 60L + difftm (tm, gmt);
+
   if ((Start + delta  Start) != (delta  0))
return -1;  /* time_t overflow */
   Start += delta;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/standard parsedate.y

2003-11-17 Thread Hartmut Holzgraefe
hholzgraTue Nov 18 01:46:07 2003 EDT

  Modified files:  
/php-src/ext/standard   parsedate.y 
  Log:
  the military time zone offsets where pointing in the wrong direction
  
  
Index: php-src/ext/standard/parsedate.y
diff -u php-src/ext/standard/parsedate.y:1.44 php-src/ext/standard/parsedate.y:1.45
--- php-src/ext/standard/parsedate.y:1.44   Tue Nov 18 01:45:01 2003
+++ php-src/ext/standard/parsedate.yTue Nov 18 01:46:07 2003
@@ -8,7 +8,7 @@
 **  This code is in the public domain and has no copyright.
 */
 
-/* $Id: parsedate.y,v 1.44 2003/11/18 06:45:01 hholzgra Exp $ */
+/* $Id: parsedate.y,v 1.45 2003/11/18 06:46:07 hholzgra Exp $ */
 
 #include php.h
 
@@ -661,30 +661,30 @@
 
 /* Military timezone table. */
 static TABLE const MilitaryTable[] = {
-{ a, tZONE,  HOUR (  1) },
-{ b, tZONE,  HOUR (  2) },
-{ c, tZONE,  HOUR (  3) },
-{ d, tZONE,  HOUR (  4) },
-{ e, tZONE,  HOUR (  5) },
-{ f, tZONE,  HOUR (  6) },
-{ g, tZONE,  HOUR (  7) },
-{ h, tZONE,  HOUR (  8) },
-{ i, tZONE,  HOUR (  9) },
-{ k, tZONE,  HOUR ( 10) },
-{ l, tZONE,  HOUR ( 11) },
-{ m, tZONE,  HOUR ( 12) },
-{ n, tZONE,  HOUR (- 1) },
-{ o, tZONE,  HOUR (- 2) },
-{ p, tZONE,  HOUR (- 3) },
-{ q, tZONE,  HOUR (- 4) },
-{ r, tZONE,  HOUR (- 5) },
-{ s, tZONE,  HOUR (- 6) },
-{ t, tTZONE, HOUR (- 7) },
-{ u, tZONE,  HOUR (- 8) },
-{ v, tZONE,  HOUR (- 9) },
-{ w, tZONE,  HOUR (-10) },
-{ x, tZONE,  HOUR (-11) },
-{ y, tZONE,  HOUR (-12) },
+{ a, tZONE,  HOUR (- 1) },
+{ b, tZONE,  HOUR (- 2) },
+{ c, tZONE,  HOUR (- 3) },
+{ d, tZONE,  HOUR (- 4) },
+{ e, tZONE,  HOUR (- 5) },
+{ f, tZONE,  HOUR (- 6) },
+{ g, tZONE,  HOUR (- 7) },
+{ h, tZONE,  HOUR (- 8) },
+{ i, tZONE,  HOUR (- 9) },
+{ k, tZONE,  HOUR (-10) },
+{ l, tZONE,  HOUR (-11) },
+{ m, tZONE,  HOUR (-12) },
+{ n, tZONE,  HOUR (  1) },
+{ o, tZONE,  HOUR (  2) },
+{ p, tZONE,  HOUR (  3) },
+{ q, tZONE,  HOUR (  4) },
+{ r, tZONE,  HOUR (  5) },
+{ s, tZONE,  HOUR (  6) },
+{ t, tTZONE, HOUR (  7) },
+{ u, tZONE,  HOUR (  8) },
+{ v, tZONE,  HOUR (  9) },
+{ w, tZONE,  HOUR ( 10) },
+{ x, tZONE,  HOUR ( 11) },
+{ y, tZONE,  HOUR ( 12) },
 { z, tZZONE, HOUR (  0) },
 { NULL, 0, 0 }
 };

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php