[PHP-CVS] com php-src: Fixed Bug #62500 (Segfault in DateInterval class when extended): NEWS ext/date/php_date.c ext/date/tests/bug62500.phpt

2012-07-08 Thread Xinchen Hui
Commit:e3b9b1e6dc016d9128ac5e9ed95aa5b1a5065e5f
Author:Xinchen Hui larue...@php.net Mon, 9 Jul 2012 00:25:48 +0800
Parents:   a213c10ef2125ac2da7a71ddb668d6f0aea8a05c
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e3b9b1e6dc016d9128ac5e9ed95aa5b1a5065e5f

Log:
Fixed Bug #62500 (Segfault in DateInterval class when extended)

This fix also fixed bug #62508  (Segfault while access a non-string
property of DateInterval object)

Bugs:
https://bugs.php.net/62500
https://bugs.php.net/62508

Changed paths:
  M  NEWS
  M  ext/date/php_date.c
  A  ext/date/tests/bug62500.phpt


Diff:
diff --git a/NEWS b/NEWS
index c1ad183..a0763ae 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ PHP 
   NEWS
 - SimpleXML:
   . Implemented FR #55218 Get namespaces from current node. (Lonny)
 
+- DateTime:
+  . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence)
+
 ?? ??? 2012, PHP 5.4.5
 
 - Core:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index cd48de2..13e7b75 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3430,10 +3430,19 @@ zval *date_interval_read_property(zval *object, zval 
*member, int type, const ze
zval_copy_ctor(tmp_member);
convert_to_string(tmp_member);
member = tmp_member;
+   key = NULL;
}
 
obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC);
 
+   if (!obj-initialized) {
+   retval = 
(zend_get_std_object_handlers())-read_property(object, member, type, key 
TSRMLS_CC);
+   if (member == tmp_member) {
+   zval_dtor(member);
+   }
+   return retval;
+   }
+
 #define GET_VALUE_FROM_STRUCT(n,m)\
if (strcmp(Z_STRVAL_P(member), m) == 0) { \
value = obj-diff-n; \
@@ -3482,9 +3491,19 @@ void date_interval_write_property(zval *object, zval 
*member, zval *value, const
zval_copy_ctor(tmp_member);
convert_to_string(tmp_member);
member = tmp_member;
+   key = NULL;
}
+
obj = (php_interval_obj *)zend_objects_get_address(object TSRMLS_CC);
 
+   if (!obj-initialized) {
+   (zend_get_std_object_handlers())-write_property(object, 
member, value, key TSRMLS_CC);
+   if (member == tmp_member) {
+   zval_dtor(member);
+   }
+   return;
+   }
+
 #define SET_VALUE_FROM_STRUCT(n,m)\
if (strcmp(Z_STRVAL_P(member), m) == 0) { \
if (value-type != IS_LONG) { \
diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt
new file mode 100644
index 000..6952332
--- /dev/null
+++ b/ext/date/tests/bug62500.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #62500 (Segfault in DateInterval class when extended)
+--INI--
+date.timezone=GMT
+--FILE--
+?php
+class Crasher extends DateInterval {
+public $foo;
+public function __construct($time_spec) {
+var_dump($this-foo);
+$this-foo = 3;
+var_dump($this-foo);
+var_dump($this-{2});
+parent::__construct($time_spec);
+}
+}
+try {
+$c = new Crasher('blah');
+} catch (Exception $e) {
+var_dump($e-getMessage());
+}
+--EXPECTF--
+NULL
+int(3)
+
+Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d
+NULL
+string(%s) DateInterval::__construct(): Unknown or bad format (blah)


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



[PHP-CVS] com php-src: - Fixed bug #62507 (['REQUEST_TIME'] under mod_php5 returns miliseconds instead of seconds): sapi/apache2filter/sapi_apache2.c

2012-07-08 Thread Felipe Pena
Commit:2019062cfc6e4b4832aaca3b73891d93adc115a8
Author:Felipe Pena felipe...@gmail.com Sun, 8 Jul 2012 14:05:28 
-0300
Parents:   e3b9b1e6dc016d9128ac5e9ed95aa5b1a5065e5f
Branches:  PHP-5.4 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2019062cfc6e4b4832aaca3b73891d93adc115a8

Log:
- Fixed bug #62507 (['REQUEST_TIME'] under mod_php5 returns miliseconds instead 
of seconds)

Bugs:
https://bugs.php.net/62507

Changed paths:
  M  sapi/apache2filter/sapi_apache2.c


Diff:
diff --git a/sapi/apache2filter/sapi_apache2.c 
b/sapi/apache2filter/sapi_apache2.c
index e8116f9..0b51cfb 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -311,7 +311,7 @@ php_apache_disable_caching(ap_filter_t *f)
 static double php_apache_sapi_get_request_time(TSRMLS_D)
 {
php_struct *ctx = SG(server_context);
-   return apr_time_as_msec(ctx-r-request_time);
+   return ((double) apr_time_as_msec(ctx-r-request_time)) / 1000.0;
 }
 
 extern zend_module_entry php_apache_module;


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



[PHP-CVS] com php-src: appease MSVC (doesnt like unary minus of unsigned ints): Zend/zend_hash.h

2012-07-08 Thread Nuno Lopes
Commit:e6d9cd983b3503d38389d0c67267c773a98af174
Author:Nuno Lopes nlop...@php.net Sun, 8 Jul 2012 15:19:41 -0400
Parents:   a76878cd594e5b8160800abb9e21cc25cb264d7f
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e6d9cd983b3503d38389d0c67267c773a98af174

Log:
appease MSVC (doesnt like unary minus of unsigned ints)

Changed paths:
  M  Zend/zend_hash.h


Diff:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 5c3b1cd..1bd6439 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -330,7 +330,7 @@ END_EXTERN_C()
if (idx-1  LONG_MAX) { /* overflow */  
\
break;  
\
}   
\
-   idx = -idx; 
\
+   idx = 0 - idx;  
\
} else if (idx  LONG_MAX) { /* overflow */ 
\
break;  
\
}   
\


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



[PHP-CVS] com php-src: appease MSVC (doesnt like unary minus of unsigned ints): Zend/zend_hash.h

2012-07-08 Thread Nuno Lopes
Commit:5910d8d4f499bf84bcaa1161bd0b89c15a19a304
Author:Nuno Lopes nlop...@php.net Sun, 8 Jul 2012 15:19:41 -0400
Parents:   2019062cfc6e4b4832aaca3b73891d93adc115a8
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5910d8d4f499bf84bcaa1161bd0b89c15a19a304

Log:
appease MSVC (doesnt like unary minus of unsigned ints)

Changed paths:
  M  Zend/zend_hash.h


Diff:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 5c3b1cd..1bd6439 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -330,7 +330,7 @@ END_EXTERN_C()
if (idx-1  LONG_MAX) { /* overflow */  
\
break;  
\
}   
\
-   idx = -idx; 
\
+   idx = 0 - idx;  
\
} else if (idx  LONG_MAX) { /* overflow */ 
\
break;  
\
}   
\


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



[PHP-CVS] com php-src: appease MSVC (doesnt like unary minus of unsigned ints): Zend/zend_hash.h

2012-07-08 Thread Nuno Lopes
Commit:b2b018d5f7d0d7a0bc88e6a95fe804c39bd65b9a
Author:Nuno Lopes nlop...@php.net Sun, 8 Jul 2012 15:19:41 -0400
Parents:   26b37f1792dfaf9b0b30f81e492c8f68b9ece571
Branches:  PHP-5.3

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b2b018d5f7d0d7a0bc88e6a95fe804c39bd65b9a

Log:
appease MSVC (doesnt like unary minus of unsigned ints)

Changed paths:
  M  Zend/zend_hash.h


Diff:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index a763fc7..81146e9 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -331,7 +331,7 @@ END_EXTERN_C()
if (idx-1  LONG_MAX) { /* overflow */  
\
break;  
\
}   
\
-   idx = -idx; 
\
+   idx = 0 - idx;  
\
} else if (idx  LONG_MAX) { /* overflow */ 
\
break;  
\
}   
\


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



Re: [PHP-CVS] com php-src: fix (signed) integer overflow (part of bug #52550: Zend/zend_hash.h

2012-07-08 Thread Nuno Lopes
Ok. I don 't have a MSVC setup handy. Can you please test if replacing 
that

line with 'idx = 0 - idx;' fixes the warnings for you?


Seems to do the trick. Is 0- same as - for unsigned on all compilers (I
know common sense says it should be but when compilers are concerned
it's better to be sure :)


Yes, it's equivalent. For subtle reasons which I'll save you from, but it is 
:)

I've committed the fix. Thanks for your help!

Nuno 



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



[PHP-CVS] com php-src: Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false): NEWS ext/curl/interface.c ext/curl/tests/bug61948.phpt

2012-07-08 Thread Xinchen Hui
Commit:c819cf9d6bd43d79b894f1d0f0c6c282893fd9bd
Author:Xinchen Hui larue...@php.net Mon, 9 Jul 2012 08:32:40 +0800
Parents:   b2b018d5f7d0d7a0bc88e6a95fe804c39bd65b9a
Branches:  PHP-5.3

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=c819cf9d6bd43d79b894f1d0f0c6c282893fd9bd

Log:
Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false)

this bc break is caused by the fix for #61948

Bugs:
https://bugs.php.net/62499
https://bugs.php.net/61948

Changed paths:
  M  NEWS
  M  ext/curl/interface.c
  M  ext/curl/tests/bug61948.phpt


Diff:
diff --git a/NEWS b/NEWS
index 782bb62..c9f3fc4 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP
NEWS
   (NEWS will be merged after release by johannes. Formerging changes to the  
   PHP-5.3.15 release branch talk to johannes)
 
+- CURL:
+  . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false).
+(r.hampartsum...@gmail.com, Laruence)
+
 14 Jun 2012, PHP 5.3.14
 
 - CLI SAPI:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 270a7dd..94be60f 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -2167,7 +2167,7 @@ string_copy:
 
convert_to_string_ex(zvalue);
 
-   if (!Z_STRLEN_PP(zvalue) || 
php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC) || (PG(safe_mode)  
!php_checkuid(Z_STRVAL_PP(zvalue), rb+, CHECKUID_CHECK_MODE_PARAM))) {
+   if ((Z_STRLEN_PP(zvalue)  
php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) || (PG(safe_mode)  
!php_checkuid(Z_STRVAL_PP(zvalue), rb+, CHECKUID_CHECK_MODE_PARAM))) {
RETVAL_FALSE;
return 1;
}
diff --git a/ext/curl/tests/bug61948.phpt b/ext/curl/tests/bug61948.phpt
index 23bbda7..00df07d 100644
--- a/ext/curl/tests/bug61948.phpt
+++ b/ext/curl/tests/bug61948.phpt
@@ -16,7 +16,7 @@ open_basedir=/tmp
   curl_close($ch);
 ?
 --EXPECTF--
-bool(false)
+bool(true)
 bool(true)
 
 Warning: curl_setopt(): open_basedir restriction in effect. File(/xxx/bar) is 
not within the allowed path(s): (/tmp) in %sbug61948.php on line %d


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



[PHP-CVS] com php-src: update NEWS: NEWS

2012-07-08 Thread Xinchen Hui
Commit:4323a7acedf0eff76f709456930d89380c16f0b8
Author:Xinchen Hui larue...@php.net Mon, 9 Jul 2012 08:44:59 +0800
Parents:   0398cc22a9fda50ad9ba0fb2d717f07a711e1732
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=4323a7acedf0eff76f709456930d89380c16f0b8

Log:
update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index a0763ae..3d91e50 100644
--- a/NEWS
+++ b/NEWS
@@ -2,12 +2,16 @@ PHP   
 NEWS
 |||
 ?? ??? 2012, PHP 5.4.6
 
-- SimpleXML:
-  . Implemented FR #55218 Get namespaces from current node. (Lonny)
+- CURL:
+  . Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false).
+(r.hampartsum...@gmail.com, Laruence)
 
 - DateTime:
   . Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence)
 
+- SimpleXML:
+  . Implemented FR #55218 Get namespaces from current node. (Lonny)
+
 ?? ??? 2012, PHP 5.4.5
 
 - Core:


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/curl/interface.c

2012-07-08 Thread Xinchen Hui
Commit:0398cc22a9fda50ad9ba0fb2d717f07a711e1732
Author:Xinchen Hui larue...@php.net Mon, 9 Jul 2012 08:38:03 +0800
Parents:   5910d8d4f499bf84bcaa1161bd0b89c15a19a304 
c819cf9d6bd43d79b894f1d0f0c6c282893fd9bd
Branches:  PHP-5.4

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0398cc22a9fda50ad9ba0fb2d717f07a711e1732

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false)
  appease MSVC (doesnt like unary minus of unsigned ints)

Conflicts:
ext/curl/interface.c

Bugs:
https://bugs.php.net/62499

Changed paths:
  MM  ext/curl/interface.c


Diff:
diff --cc ext/curl/interface.c
index b03f346,94be60f..d7d5c51
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@@ -2177,7 -2167,7 +2177,7 @@@ string_copy
  
convert_to_string_ex(zvalue);
  
-   if (!Z_STRLEN_PP(zvalue) || 
php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) {
 -  if ((Z_STRLEN_PP(zvalue)  
php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) || (PG(safe_mode)  
!php_checkuid(Z_STRVAL_PP(zvalue), rb+, CHECKUID_CHECK_MODE_PARAM))) {
++  if (Z_STRLEN_PP(zvalue)  
php_check_open_basedir(Z_STRVAL_PP(zvalue) TSRMLS_CC)) {
RETVAL_FALSE;
return 1;
}


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



[PHP-CVS] com php-src: Merge branch 'PHP-5.4': ext/curl/interface.c

2012-07-08 Thread Xinchen Hui
Commit:0e97cdf86b8db73c5d80e5eaeb7efc99ae6383de
Author:Xinchen Hui larue...@php.net Mon, 9 Jul 2012 08:46:38 +0800
Parents:   e6d9cd983b3503d38389d0c67267c773a98af174 
4323a7acedf0eff76f709456930d89380c16f0b8
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=0e97cdf86b8db73c5d80e5eaeb7efc99ae6383de

Log:
Merge branch 'PHP-5.4'

* PHP-5.4:
  update NEWS
  Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, ) returns false)
  appease MSVC (doesnt like unary minus of unsigned ints)
  appease MSVC (doesnt like unary minus of unsigned ints)

Bugs:
https://bugs.php.net/62499

Changed paths:
  MM  ext/curl/interface.c


Diff:



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