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

2013-05-16 Thread Anatol Belski
Commit:07bd1fac57b1f608c15c5d5ebaa6d9383c7cc564
Author:Anatol Belski a...@php.net Thu, 16 May 2013 08:44:36 +0200
Parents:   fda25c7ea68a35d55cc72368a344a787608a0b29
Branches:  PHP-5.5 master

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

Log:
updated NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 99dcbe7..95ef3dc 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP
NEWS
 |||
 ?? ??? 2013, PHP 5.5.0 Release Candidate 2
 
+- Core:
+  . Fixed bug #64853 (Use of no longer available ini directives causes crash
+on TS build). (Anatol)
+
 - Fileinfo:
   . Fixed bug #64830 (mimetype detection segfaults on mp3 file). (Anatol)


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



[PHP-CVS] com php-src: Fixed bug #64853Use of no longer available ini directives causes crash on TS build: NEWS main/main.c

2013-05-16 Thread Anatol Belski
Commit:d82704b6779cf54e9c8bd16ecc78c612892b4c9d
Author:Anatol Belski a...@php.net Thu, 16 May 2013 08:40:56 +0200
Parents:   09470ebf35a47ac34c3ffa5524ccb47ff404cd5a
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
Fixed bug #64853Use of no longer available ini directives causes crash on TS 
build

The fatal error for removed ini options is thrown before the executor
init, so ensure the relevant variables are initialized.

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

Changed paths:
  M  NEWS
  M  main/main.c


Diff:
diff --git a/NEWS b/NEWS
index 879f13b..5aeb4c9 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP 
   NEWS
 
 - Core:
   . Fixed bug #64729 (compilation failure on x32). (Gustavo)
+  . Fixed bug #64853 (Use of no longer available ini directives causes crash on
+TS build). (Anatol)
 
 - Fileinfo:
   . Fixed bug #64830 (mimetype detection segfaults on mp3 file). (Anatol)
diff --git a/main/main.c b/main/main.c
index 7a253f8..c0db64d 100644
--- a/main/main.c
+++ b/main/main.c
@@ -2070,6 +2070,8 @@ int php_module_startup(sapi_module_struct *sf, 
zend_module_entry *additional_mod
EG(exception_class) = NULL;
PG(disable_functions) = NULL;
PG(disable_classes) = NULL;
+   EG(exception) = NULL;
+   EG(objects_store).object_buckets = NULL;
 
 #if HAVE_SETLOCALE
setlocale(LC_CTYPE, );


--
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' into PHP-5.5: main/main.c

2013-05-16 Thread Anatol Belski
Commit:fda25c7ea68a35d55cc72368a344a787608a0b29
Author:Anatol Belski a...@php.net Thu, 16 May 2013 08:43:07 +0200
Parents:   9accfee55f80ec7da23bb948c49fcaa3e97bc2ca 
d82704b6779cf54e9c8bd16ecc78c612892b4c9d
Branches:  PHP-5.5 master

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

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

* PHP-5.4:
  Fixed bug #64853Use of no longer available ini directives causes crash on TS 
build

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

Changed paths:
  MM  main/main.c


Diff:



--
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.5': main/main.c

2013-05-16 Thread Anatol Belski
Commit:2933f77e39fae55b48bf685e8b2da474f1274eb5
Author:Anatol Belski a...@php.net Thu, 16 May 2013 08:45:02 +0200
Parents:   f5d5a50a1c3fe406d87edaa6396e690588c7be81 
07bd1fac57b1f608c15c5d5ebaa6d9383c7cc564
Branches:  master

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

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  updated NEWS
  Fixed bug #64853Use of no longer available ini directives causes crash on TS 
build

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

Changed paths:
  MM  main/main.c


Diff:



--
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' into PHP-5.5: ext/sockets/sockets.c

2013-05-16 Thread Anatol Belski
Commit:d565e8f0eb329cee8430cd79f8e149998b389928
Author:Anatol Belski a...@php.net Thu, 16 May 2013 19:29:25 +0200
Parents:   07bd1fac57b1f608c15c5d5ebaa6d9383c7cc564 
8dec06ea2afbe577191b13152e8f4622a80aeb0c
Branches:  PHP-5.5 master

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

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

* PHP-5.4:
  Fixed error handling for ext/sockets under win

Changed paths:
  MM  ext/sockets/sockets.c


Diff:



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



[PHP-CVS] com php-src: Fixed error handling for ext/sockets under win: ext/sockets/sockets.c

2013-05-16 Thread Anatol Belski
Commit:8dec06ea2afbe577191b13152e8f4622a80aeb0c
Author:Anatol Belski a...@php.net Thu, 16 May 2013 19:23:31 +0200
Parents:   d82704b6779cf54e9c8bd16ecc78c612892b4c9d
Branches:  PHP-5.4 PHP-5.5 master

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

Log:
Fixed error handling for ext/sockets under win

WSAGetLastError() must be the very next call after a socket
function had an invalid return. Any function call inbetween
will clear the error information.

Changed paths:
  M  ext/sockets/sockets.c


Diff:
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 06bd0ec..b3bcbf2 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1822,8 +1822,8 @@ PHP_FUNCTION(socket_recvfrom)
retval = recvfrom(php_sock-bsd_socket, recv_buf, arg3, 
arg4, (struct sockaddr *)s_un, (socklen_t *)slen);
 
if (retval  0) {
-   efree(recv_buf);
PHP_SOCKET_ERROR(php_sock, unable to 
recvfrom, errno);
+   efree(recv_buf);
RETURN_FALSE;
}
 
@@ -1847,8 +1847,8 @@ PHP_FUNCTION(socket_recvfrom)
retval = recvfrom(php_sock-bsd_socket, recv_buf, arg3, 
arg4, (struct sockaddr *)sin, (socklen_t *)slen);
 
if (retval  0) {
-   efree(recv_buf);
PHP_SOCKET_ERROR(php_sock, unable to 
recvfrom, errno);
+   efree(recv_buf);
RETURN_FALSE;
}
 
@@ -1876,8 +1876,8 @@ PHP_FUNCTION(socket_recvfrom)
retval = recvfrom(php_sock-bsd_socket, recv_buf, arg3, 
arg4, (struct sockaddr *)sin6, (socklen_t *)slen);
 
if (retval  0) {
-   efree(recv_buf);
PHP_SOCKET_ERROR(php_sock, unable to 
recvfrom, errno);
+   efree(recv_buf);
RETURN_FALSE;
}


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



[PHP-CVS] com php-src: Add optional second arg to unserialize(): ext/standard/basic_functions.c ext/standard/tests/serialize/serialization_error_001.phpt ext/standard/tests/serialize/unserialize_consu

2013-05-16 Thread Sara Golemon
Commit:cfd104582220d578ab1b78a5991065d038e1f931
Author:Sara Golemon poll...@php.net Thu, 16 May 2013 14:37:36 
-0700
Parents:   bc656cde0453aa6de50812ba9edfc6f74c61ce37
Branches:  master

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

Log:
Add optional second arg to unserialize()

Returns the number of bytes consumed by reference for
streaming unserialization.

Actual unserialization behavior is not modified at all.

The need for this came up while trying to parse SplDoublyLinkedList's
serialization format which uses a non-standard stream of serialized values.

Changed paths:
  M  ext/standard/basic_functions.c
  M  ext/standard/tests/serialize/serialization_error_001.phpt
  A  ext/standard/tests/serialize/unserialize_consumed.phpt
  M  ext/standard/var.c


Diff:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 9c91404..1379117 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -2679,6 +2679,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO(arginfo_unserialize, 0)
ZEND_ARG_INFO(0, variable_representation)
+   ZEND_ARG_INFO(1, consumed)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0)
diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt 
b/ext/standard/tests/serialize/serialization_error_001.phpt
index da6f50c..c6c1751 100644
--- a/ext/standard/tests/serialize/serialization_error_001.phpt
+++ b/ext/standard/tests/serialize/serialization_error_001.phpt
@@ -21,7 +21,7 @@ var_dump( unserialize() );
 
 //Test serialize with one more than the expected number of arguments
 var_dump( serialize(1,2) );
-var_dump( unserialize(1,2) );
+var_dump( unserialize(1,$x,2) );
 
 echo Done;
 ?
@@ -31,12 +31,12 @@ echo Done;
 Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16
 NULL
 
-Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17
+Warning: unserialize() expects at least 1 parameter, 0 given in %s on line 17
 bool(false)
 
 Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20
 NULL
 
-Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21
+Warning: unserialize() expects at most 2 parameters, 3 given in %s on line 21
 bool(false)
 Done
diff --git a/ext/standard/tests/serialize/unserialize_consumed.phpt 
b/ext/standard/tests/serialize/unserialize_consumed.phpt
new file mode 100644
index 000..6cc11e2
--- /dev/null
+++ b/ext/standard/tests/serialize/unserialize_consumed.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Unserialization of partial strings
+--FILE--
+?php
+$data = [123,4.56,true];
+$ser = serialize($data);
+$serlen = strlen($ser);
+
+$unser = unserialize($ser, $consumed);
+echo Consume full string: ;
+var_dump($serlen == $consumed);
+echo Return original data: ;
+var_dump($unser === $data);
+
+$ser .= junk\x01data;
+$unser = unserialize($ser, $consumed);
+echo Consume full string(junk): ;
+var_dump($serlen == $consumed);
+echo Return original data(junk): ;
+var_dump($unser === $data);
+
+--EXPECT--
+Consume full string: bool(true)
+Return original data: bool(true)
+Consume full string(junk): bool(true)
+Return original data(junk): bool(true)
+
diff --git a/ext/standard/var.c b/ext/standard/var.c
index f76a14c..4acc6f5 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -945,7 +945,7 @@ PHP_FUNCTION(serialize)
 }
 /* }}} */
 
-/* {{{ proto mixed unserialize(string variable_representation)
+/* {{{ proto mixed unserialize(string variable_representation[, int consumed])
Takes a string representation of variable and recreates it */
 PHP_FUNCTION(unserialize)
 {
@@ -953,8 +953,9 @@ PHP_FUNCTION(unserialize)
int buf_len;
const unsigned char *p;
php_unserialize_data_t var_hash;
+   zval *consumed = NULL;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, buf, 
buf_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z, buf, 
buf_len, consumed) == FAILURE) {
RETURN_FALSE;
}
 
@@ -973,6 +974,11 @@ PHP_FUNCTION(unserialize)
RETURN_FALSE;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+   if (consumed) {
+   zval_dtor(consumed);
+   ZVAL_LONG(consumed, ((char*)p) - buf);
+   }
 }
 /* }}} */


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



Re: [PHP-CVS] com php-src: Add optional second arg to unserialize(): ext/standard/basic_functions.c ext/standard/tests/serialize/serialization_error_001.phpt ext/standard/tests/serialize/unserialize_c

2013-05-16 Thread Pierre Joye
hi Sara!

Please add a note to UPGRADING as well.

Thanks!
--
Cheers,

On Fri, May 17, 2013 at 12:18 AM, Sara Golemon poll...@php.net wrote:
 Commit:cfd104582220d578ab1b78a5991065d038e1f931
 Author:Sara Golemon poll...@php.net Thu, 16 May 2013 14:37:36 
 -0700
 Parents:   bc656cde0453aa6de50812ba9edfc6f74c61ce37
 Branches:  master

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

 Log:
 Add optional second arg to unserialize()

 Returns the number of bytes consumed by reference for
 streaming unserialization.

 Actual unserialization behavior is not modified at all.

 The need for this came up while trying to parse SplDoublyLinkedList's
 serialization format which uses a non-standard stream of serialized values.

 Changed paths:
   M  ext/standard/basic_functions.c
   M  ext/standard/tests/serialize/serialization_error_001.phpt
   A  ext/standard/tests/serialize/unserialize_consumed.phpt
   M  ext/standard/var.c


 Diff:
 diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
 index 9c91404..1379117 100644
 --- a/ext/standard/basic_functions.c
 +++ b/ext/standard/basic_functions.c
 @@ -2679,6 +2679,7 @@ ZEND_END_ARG_INFO()

  ZEND_BEGIN_ARG_INFO(arginfo_unserialize, 0)
 ZEND_ARG_INFO(0, variable_representation)
 +   ZEND_ARG_INFO(1, consumed)
  ZEND_END_ARG_INFO()

  ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0)
 diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt 
 b/ext/standard/tests/serialize/serialization_error_001.phpt
 index da6f50c..c6c1751 100644
 --- a/ext/standard/tests/serialize/serialization_error_001.phpt
 +++ b/ext/standard/tests/serialize/serialization_error_001.phpt
 @@ -21,7 +21,7 @@ var_dump( unserialize() );

  //Test serialize with one more than the expected number of arguments
  var_dump( serialize(1,2) );
 -var_dump( unserialize(1,2) );
 +var_dump( unserialize(1,$x,2) );

  echo Done;
  ?
 @@ -31,12 +31,12 @@ echo Done;
  Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16
  NULL

 -Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17
 +Warning: unserialize() expects at least 1 parameter, 0 given in %s on line 17
  bool(false)

  Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20
  NULL

 -Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21
 +Warning: unserialize() expects at most 2 parameters, 3 given in %s on line 21
  bool(false)
  Done
 diff --git a/ext/standard/tests/serialize/unserialize_consumed.phpt 
 b/ext/standard/tests/serialize/unserialize_consumed.phpt
 new file mode 100644
 index 000..6cc11e2
 --- /dev/null
 +++ b/ext/standard/tests/serialize/unserialize_consumed.phpt
 @@ -0,0 +1,27 @@
 +--TEST--
 +Unserialization of partial strings
 +--FILE--
 +?php
 +$data = [123,4.56,true];
 +$ser = serialize($data);
 +$serlen = strlen($ser);
 +
 +$unser = unserialize($ser, $consumed);
 +echo Consume full string: ;
 +var_dump($serlen == $consumed);
 +echo Return original data: ;
 +var_dump($unser === $data);
 +
 +$ser .= junk\x01data;
 +$unser = unserialize($ser, $consumed);
 +echo Consume full string(junk): ;
 +var_dump($serlen == $consumed);
 +echo Return original data(junk): ;
 +var_dump($unser === $data);
 +
 +--EXPECT--
 +Consume full string: bool(true)
 +Return original data: bool(true)
 +Consume full string(junk): bool(true)
 +Return original data(junk): bool(true)
 +
 diff --git a/ext/standard/var.c b/ext/standard/var.c
 index f76a14c..4acc6f5 100644
 --- a/ext/standard/var.c
 +++ b/ext/standard/var.c
 @@ -945,7 +945,7 @@ PHP_FUNCTION(serialize)
  }
  /* }}} */

 -/* {{{ proto mixed unserialize(string variable_representation)
 +/* {{{ proto mixed unserialize(string variable_representation[, int 
 consumed])
 Takes a string representation of variable and recreates it */
  PHP_FUNCTION(unserialize)
  {
 @@ -953,8 +953,9 @@ PHP_FUNCTION(unserialize)
 int buf_len;
 const unsigned char *p;
 php_unserialize_data_t var_hash;
 +   zval *consumed = NULL;

 -   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, buf, 
 buf_len) == FAILURE) {
 +   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z, buf, 
 buf_len, consumed) == FAILURE) {
 RETURN_FALSE;
 }

 @@ -973,6 +974,11 @@ PHP_FUNCTION(unserialize)
 RETURN_FALSE;
 }
 PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
 +
 +   if (consumed) {
 +   zval_dtor(consumed);
 +   ZVAL_LONG(consumed, ((char*)p) - buf);
 +   }
  }
  /* }}} */


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




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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