Re: [PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/standard/tests/file/bug52820.phpt

2012-12-23 Thread Ferenc Kovacs
Hi,

Laruence, why didn't you merged your commits related to bug 63377 from the
5.3 branch upwards?
Pierrick: it seems that you tried to merge the fix to the bug63377 test
which isn't present in the 5.4 branch.
Even if the bug isn't present in the new output buffer code it would be
nice imo if we would add the test to the 5.4, 5.5 and master branches so we
can catch regressions, etc.


On Fri, Dec 21, 2012 at 6:24 PM, Pierrick Charron pierr...@php.net wrote:

 Commit:59a4514dc0e8950ce210036332cc64c414fdcc22
 Author:Pierrick Charron pierr...@php.net Fri, 21 Dec 2012
 12:24:52 -0500
 Parents:   763bce0303b3afd19d109d96c37d6d33a899e990
 63659ce52678500ec024f1146ebf30e70624b935
 Branches:  PHP-5.4 PHP-5.5 master

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

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

 * PHP-5.3:
   Fix test to work on every libcurl version
   - Fixed typo on SKIPIF (causing make test to abort on some systems)

 Conflicts:
 tests/output/bug63377.phpt

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

 Changed paths:
   MM  ext/standard/tests/file/bug52820.phpt


 Diff:
 diff --cc ext/standard/tests/file/bug52820.phpt
 index 8a1e7cc,19d0e9e..91976b0
 --- a/ext/standard/tests/file/bug52820.phpt
 +++ b/ext/standard/tests/file/bug52820.phpt
 @@@ -50,22 -42,8 +50,22 @@@ About to rewind
   memory stream (close after):
   About to rewind!
   * About to connect() to 127.0.0.1 port 37349%r.*%r
 - *   Trying 127.0.0.1... * Connection refused
 - * couldn't connect to host
 + *   Trying 127.0.0.1...%A* Connection refused
 + * couldn't connect to host%S
   * Closing connection #0

  +temp stream (leak):
  +About to rewind!
  +* About to connect() to 127.0.0.1 port 37349%r.*%r
 - *   Trying 127.0.0.1... * Connection refused
 - * couldn't connect to host
 ++*   Trying 127.0.0.1...%A* Connection refused
 ++* couldn't connect to host%S
  +* Closing connection #0
  +
  +memory stream (leak):
  +About to rewind!
  +* About to connect() to 127.0.0.1 port 37349%r.*%r
 - *   Trying 127.0.0.1... * Connection refused
 - * couldn't connect to host
 ++*   Trying 127.0.0.1...%A* Connection refused
 ++* couldn't connect to host%S
  +* Closing connection #0
  +
   Done.


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




-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


Re: [PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/standard/tests/file/bug52820.phpt

2012-12-23 Thread Pierrick Charron
Hi

On 23 December 2012 12:47, Ferenc Kovacs tyr...@gmail.com wrote:
 Hi,

 Laruence, why didn't you merged your commits related to bug 63377 from the
 5.3 branch upwards?

His commit was I think merged, what you're seeing in this merge is
only commit 56d9edbbb93
which was a typo corrected by Felipe.

 Pierrick: it seems that you tried to merge the fix to the bug63377 test
 which isn't present in the 5.4 branch.

It's only git who tried to merge the 56d9edbbb93 commit into 5.4 since
it wasn't merged before.
Because the file doesn't exists in 5.4, git made a conflict that I had
to resolve by just saying that the file don't exists and that it was
normal.

 Even if the bug isn't present in the new output buffer code it would be
 nice imo if we would add the test to the 5.4, 5.5 and master branches so we
 can catch regressions, etc.

Agree



 On Fri, Dec 21, 2012 at 6:24 PM, Pierrick Charron pierr...@php.net wrote:

 Commit:59a4514dc0e8950ce210036332cc64c414fdcc22
 Author:Pierrick Charron pierr...@php.net Fri, 21 Dec 2012
 12:24:52 -0500
 Parents:   763bce0303b3afd19d109d96c37d6d33a899e990
 63659ce52678500ec024f1146ebf30e70624b935
 Branches:  PHP-5.4 PHP-5.5 master

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

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

 * PHP-5.3:
   Fix test to work on every libcurl version
   - Fixed typo on SKIPIF (causing make test to abort on some systems)

 Conflicts:
 tests/output/bug63377.phpt

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

 Changed paths:
   MM  ext/standard/tests/file/bug52820.phpt


 Diff:
 diff --cc ext/standard/tests/file/bug52820.phpt
 index 8a1e7cc,19d0e9e..91976b0
 --- a/ext/standard/tests/file/bug52820.phpt
 +++ b/ext/standard/tests/file/bug52820.phpt
 @@@ -50,22 -42,8 +50,22 @@@ About to rewind
   memory stream (close after):
   About to rewind!
   * About to connect() to 127.0.0.1 port 37349%r.*%r
 - *   Trying 127.0.0.1... * Connection refused
 - * couldn't connect to host
 + *   Trying 127.0.0.1...%A* Connection refused
 + * couldn't connect to host%S
   * Closing connection #0

  +temp stream (leak):
  +About to rewind!
  +* About to connect() to 127.0.0.1 port 37349%r.*%r
 - *   Trying 127.0.0.1... * Connection refused
 - * couldn't connect to host
 ++*   Trying 127.0.0.1...%A* Connection refused
 ++* couldn't connect to host%S
  +* Closing connection #0
  +
  +memory stream (leak):
  +About to rewind!
  +* About to connect() to 127.0.0.1 port 37349%r.*%r
 - *   Trying 127.0.0.1... * Connection refused
 - * couldn't connect to host
 ++*   Trying 127.0.0.1...%A* Connection refused
 ++* couldn't connect to host%S
  +* Closing connection #0
  +
   Done.


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




 --
 Ferenc Kovács
 @Tyr43l - http://tyrael.hu

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



Re: [PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/standard/tests/file/bug52820.phpt

2012-12-23 Thread Ferenc Kovacs
On Sun, Dec 23, 2012 at 7:21 PM, Pierrick Charron pierr...@php.net wrote:

 His commit was I think merged, what you're seeing in this merge is


If it was merged then why is the testfile missing (causing your merge
conflict)?

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


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

2012-12-23 Thread Pierrick Charron
Commit:24f1ef1b0254d4b8341aa9d74ca450e89c2a8683
Author:Pierrick Charron pierr...@php.net Sun, 23 Dec 2012 
17:48:05 -0500
Parents:   33f44af1a773d271ec96bbec445d625313195176
Branches:  PHP-5.5 master

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

Log:
Update NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 019513a..54b4455 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,11 @@ PHP
NEWS
   . Fixed bug #63822 (Crash when using closures with ArrayAccess).
 (Nikita Popov)
 
+- cURL:
+  . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
+curl_pause, curl_reset, curl_share_close, curl_share_init, 
+   curl_share_setopt curl_strerror and curl_unescape. (Pierrick)
+
 18 Dec 2012, PHP 5.5.0 Alpha 2
 
 - General improvements:


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



[PHP-CVS] com php-src: New curl_pause() function: ext/curl/interface.c ext/curl/php_curl.h

2012-12-23 Thread Pierrick Charron
Commit:33f44af1a773d271ec96bbec445d625313195176
Author:Pierrick Charron pierr...@php.net Sun, 23 Dec 2012 
17:13:49 -0500
Parents:   4b4f3db73142799da71be14d73938456e918b3ac
Branches:  PHP-5.5 master

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

Log:
New curl_pause() function

Add the curl_pause function (binding of curl_easy_pause).
Using this function, you can explicitly mark a running connection
to get paused, and you can unpause a connection that was
previously paused.

Changed paths:
  M  ext/curl/interface.c
  M  ext/curl/php_curl.h


Diff:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 21d4bb1..06e5eb2 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -396,6 +396,13 @@ ZEND_BEGIN_ARG_INFO(arginfo_curl_share_setopt, 0)
ZEND_ARG_INFO(0, option)
ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()
+
+#if LIBCURL_VERSION_NUM = 0x071200 /* Available since 7.18.0 */
+ZEND_BEGIN_ARG_INFO(arginfo_curl_pause, 0)
+   ZEND_ARG_INFO(0, ch)
+   ZEND_ARG_INFO(0, bitmask)
+ZEND_END_ARG_INFO()
+#endif
 /* }}} */
 
 /* {{{ curl_functions[]
@@ -422,6 +429,9 @@ const zend_function_entry curl_functions[] = {
PHP_FE(curl_escape,  arginfo_curl_escape)
PHP_FE(curl_unescape,arginfo_curl_unescape)
 #endif
+#if LIBCURL_VERSION_NUM = 0x071200 /* 7.18.0 */
+   PHP_FE(curl_pause,   arginfo_curl_pause)
+#endif
PHP_FE(curl_multi_init,  arginfo_curl_multi_init)
PHP_FE(curl_multi_add_handle,arginfo_curl_multi_add_handle)
PHP_FE(curl_multi_remove_handle, arginfo_curl_multi_remove_handle)
@@ -999,6 +1009,14 @@ PHP_MINIT_FUNCTION(curl)
 
 #if LIBCURL_VERSION_NUM = 0x071200 /* Available since 7.18.0 */
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TRANSFER_MODE);
+   REGISTER_CURL_CONSTANT(CURLPAUSE_ALL);
+   REGISTER_CURL_CONSTANT(CURLPAUSE_CONT);
+   REGISTER_CURL_CONSTANT(CURLPAUSE_RECV);
+   REGISTER_CURL_CONSTANT(CURLPAUSE_RECV_CONT);
+   REGISTER_CURL_CONSTANT(CURLPAUSE_SEND);
+   REGISTER_CURL_CONSTANT(CURLPAUSE_SEND_CONT);
+   REGISTER_CURL_CONSTANT(CURL_READFUNC_PAUSE);
+   REGISTER_CURL_CONSTANT(CURL_WRITEFUNC_PAUSE);
 #endif
 
 #if LIBCURL_VERSION_NUM = 0x071202 /* Available since 7.18.2 */
@@ -3417,8 +3435,29 @@ PHP_FUNCTION(curl_unescape)
RETURN_FALSE;
}
 }
+/* }}} */
 #endif
+
+#if LIBCURL_VERSION_NUM = 0x071200 /* 7.18.0 */
+/* {{{ proto void curl_pause(resource ch, int bitmask)
+   pause and unpause a connection */
+PHP_FUNCTION(curl_pause)
+{
+   long   bitmask;
+   zval   *zid;
+   php_curl   *ch;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, zid, 
bitmask) == FAILURE) {
+   return;
+   }
+
+   ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
+
+   RETURN_LONG(curl_easy_pause(ch-cp, bitmask)); 
+}
 /* }}} */
+#endif
+
 #endif /* HAVE_CURL */
 
 /*
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 2c97bca..de8eb7e 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -100,6 +100,10 @@ PHP_FUNCTION(curl_unescape);
 PHP_FUNCTION(curl_multi_setopt);
 #endif
 
+#if LIBCURL_VERSION_NUM = 0x071200 /* 7.18.0 */
+PHP_FUNCTION(curl_pause);
+#endif
+
 void _php_curl_multi_close(zend_rsrc_list_entry * TSRMLS_DC);
 void _php_curl_share_close(zend_rsrc_list_entry * TSRMLS_DC);


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



[PHP-CVS] com php-src: Support for curl_strerror and curl_multi_strerror: ext/curl/interface.c ext/curl/multi.c ext/curl/php_curl.h ext/curl/tests/curl_multi_strerror_001.phpt ext/curl/tests/curl_stre

2012-12-23 Thread Pierrick Charron
Commit:4b4f3db73142799da71be14d73938456e918b3ac
Author:Pierrick Charron pierr...@php.net Sun, 23 Dec 2012 
15:45:39 -0500
Parents:   64595a5d1a51417ae518e124c61e1a9840d221a8
Branches:  PHP-5.5 master

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

Log:
Support for curl_strerror and curl_multi_strerror

Add the support for both curl_strerror and curl_multi_strerror.
Those function will return a string describing the error code
passed in the argument errornum

Changed paths:
  M  ext/curl/interface.c
  M  ext/curl/multi.c
  M  ext/curl/php_curl.h
  A  ext/curl/tests/curl_multi_strerror_001.phpt
  A  ext/curl/tests/curl_strerror_001.phpt


Diff:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index a0a4ec5..21d4bb1 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -374,6 +374,16 @@ ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_close, 0)
ZEND_ARG_INFO(0, mh)
 ZEND_END_ARG_INFO()
 
+#if LIBCURL_VERSION_NUM = 0x070c00 /* Available since 7.12.0 */
+ZEND_BEGIN_ARG_INFO(arginfo_curl_strerror, 0)
+   ZEND_ARG_INFO(0, errornum)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_strerror, 0)
+   ZEND_ARG_INFO(0, errornum)
+ZEND_END_ARG_INFO()
+#endif
+
 ZEND_BEGIN_ARG_INFO(arginfo_curl_share_init, 0)
 ZEND_END_ARG_INFO()
 
@@ -401,6 +411,10 @@ const zend_function_entry curl_functions[] = {
PHP_FE(curl_error,   arginfo_curl_error)
PHP_FE(curl_errno,   arginfo_curl_errno)
PHP_FE(curl_close,   arginfo_curl_close)
+#if LIBCURL_VERSION_NUM = 0x070c00 /* 7.12.0 */
+   PHP_FE(curl_strerror,arginfo_curl_strerror)
+   PHP_FE(curl_multi_strerror,  arginfo_curl_multi_strerror)
+#endif
 #if LIBCURL_VERSION_NUM = 0x070c01 /* 7.12.1 */
PHP_FE(curl_reset,   arginfo_curl_reset)
 #endif
@@ -3256,6 +3270,28 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc 
TSRMLS_DC)
 }
 /* }}} */
 
+#if LIBCURL_VERSION_NUM = 0x070c00 /* Available since 7.12.0 */
+/* {{{ proto bool curl_strerror(int code)
+  return string describing error code */
+PHP_FUNCTION(curl_strerror)
+{
+   long code;
+   const char *str;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, code) == 
FAILURE) {
+   return;
+   }
+
+   str = curl_easy_strerror(code);
+   if (str) {
+   RETURN_STRING(str, 1);
+   } else {
+   RETURN_NULL();
+   }
+}
+/* }}} */
+#endif
+
 #if LIBCURL_VERSION_NUM = 0x070c01 /* 7.12.1 */
 /* {{{ _php_curl_reset_handlers()
Reset all handlers of a given php_curl */
@@ -3280,7 +3316,7 @@ static void _php_curl_reset_handlers(php_curl *ch)
ch-handlers-read-stream = NULL;
}
ch-handlers-read-fp = NULL;
-   ch-handlers-read-fd = NULL;
+   ch-handlers-read-fd = 0;
ch-handlers-read-method  = PHP_CURL_DIRECT;
 
if (ch-handlers-std_err) {
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index 48655ba..4cf9d5f 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -359,6 +359,28 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc 
TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
+#if LIBCURL_VERSION_NUM = 0x070c00 /* Available since 7.12.0 */
+/* {{{ proto bool curl_multi_strerror(int code)
+ return string describing error code */
+PHP_FUNCTION(curl_multi_strerror)
+{
+   long code;
+   const char *str;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, code) == 
FAILURE) {
+   return;
+   }
+
+   str = curl_multi_strerror(code);
+   if (str) {
+   RETURN_STRING(str, 1);
+   } else {
+   RETURN_NULL();
+   }
+}
+/* }}} */
+#endif
+
 #if LIBCURL_VERSION_NUM = 0x070f04 /* 7.15.4 */
 static int _php_curl_multi_setopt(php_curlm *mh, long option, zval **zvalue, 
zval *return_value TSRMLS_DC) /* {{{ */
 { 
@@ -389,7 +411,6 @@ static int _php_curl_multi_setopt(php_curlm *mh, long 
option, zval **zvalue, zva
 }
 /* }}} */
 
-
 /* {{{ proto int curl_multi_setopt(resource mh, int option, mixed value)
Set an option for the curl multi handle */
 PHP_FUNCTION(curl_multi_setopt)
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index d00b431..2c97bca 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -84,6 +84,11 @@ PHP_FUNCTION(curl_share_close);
 PHP_FUNCTION(curl_share_init);
 PHP_FUNCTION(curl_share_setopt);
 
+#if LIBCURL_VERSION_NUM = 0x070c00 /* 7.12.0 */
+PHP_FUNCTION(curl_strerror);
+PHP_FUNCTION(curl_multi_strerror);
+#endif
+
 #if LIBCURL_VERSION_NUM = 0x070c01 /* 7.12.1 */
 PHP_FUNCTION(curl_reset);
 #endif
diff --git a/ext/curl/tests/curl_multi_strerror_001.phpt 
b/ext/curl/tests/curl_multi_strerror_001.phpt
new file mode 100644
index 000..85a665c
--- /dev/null
+++ b/ext/curl/tests/curl_multi_strerror_001.phpt
@@ -0,0 +1,20 @@
+--TEST--
+curl_multi_strerror basic test
+--SKIPIF--
+if 

[PHP-CVS] com php-src: Add curl_multi_setopt and clean curl_share_setopt: ext/curl/interface.c ext/curl/multi.c ext/curl/php_curl.h ext/curl/share.c ext/curl/tests/curl_multi_setopt_basic001.phpt ext/

2012-12-23 Thread Pierrick Charron
Commit:64595a5d1a51417ae518e124c61e1a9840d221a8
Author:Pierrick Charron pierr...@php.net Sun, 23 Dec 2012 
14:59:41 -0500
Parents:   ded889e865825b41e9484a47bfbcbd4b6ed15d50
Branches:  PHP-5.5 master

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

Log:
Add curl_multi_setopt and clean curl_share_setopt

curl_multi_setopt is now available and supports CURLMOPT_PIPELINING
and CURLMOPT_MAXCONNECTS

Changed paths:
  M  ext/curl/interface.c
  M  ext/curl/multi.c
  M  ext/curl/php_curl.h
  M  ext/curl/share.c
  A  ext/curl/tests/curl_multi_setopt_basic001.phpt
  A  ext/curl/tests/curl_share_setopt_basic001.phpt


Diff:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 8b61764..a0a4ec5 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -330,6 +330,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_curl_unescape, 0)
ZEND_ARG_INFO(0, ch)
ZEND_ARG_INFO(0, str)
 ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_setopt, 0)
+   ZEND_ARG_INFO(0, sh)
+   ZEND_ARG_INFO(0, option)
+   ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
 #endif
 
 ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_init, 0)
@@ -410,6 +416,9 @@ const zend_function_entry curl_functions[] = {
PHP_FE(curl_multi_getcontent,arginfo_curl_multi_getcontent)
PHP_FE(curl_multi_info_read, arginfo_curl_multi_info_read)
PHP_FE(curl_multi_close, arginfo_curl_multi_close)
+#if LIBCURL_VERSION_NUM = 0x070f04 /* 7.15.4 */
+   PHP_FE(curl_multi_setopt,arginfo_curl_multi_setopt)
+#endif
PHP_FE(curl_share_init,  arginfo_curl_share_init)
PHP_FE(curl_share_close, arginfo_curl_share_close)
PHP_FE(curl_share_setopt,arginfo_curl_share_setopt)
@@ -928,6 +937,7 @@ PHP_MINIT_FUNCTION(curl)
 
 #if LIBCURL_VERSION_NUM = 0x071000 /* Available since 7.16.0 */
REGISTER_CURL_CONSTANT(CURLOPT_SSL_SESSIONID_CACHE);
+   REGISTER_CURL_CONSTANT(CURLMOPT_PIPELINING);
 #endif
 
 #if LIBCURL_VERSION_NUM = 0x071001 /* Available since 7.16.1 */
@@ -948,6 +958,10 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT_MS);
 #endif
 
+#if LIBCURL_VERSION_NUM = 0x071003 /* Available since 7.16.3 */
+   REGISTER_CURL_CONSTANT(CURLMOPT_MAXCONNECTS);
+#endif
+
 #if LIBCURL_VERSION_NUM = 0x071004 /* Available since 7.16.4 */
REGISTER_CURL_CONSTANT(CURLOPT_KRBLEVEL);
REGISTER_CURL_CONSTANT(CURLOPT_NEW_DIRECTORY_PERMS);
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index eedcb6a..48655ba 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -359,6 +359,60 @@ void _php_curl_multi_close(zend_rsrc_list_entry *rsrc 
TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
+#if LIBCURL_VERSION_NUM = 0x070f04 /* 7.15.4 */
+static int _php_curl_multi_setopt(php_curlm *mh, long option, zval **zvalue, 
zval *return_value TSRMLS_DC) /* {{{ */
+{ 
+   CURLMcode error = CURLM_OK;
+
+   switch (option) {
+#if LIBCURL_VERSION_NUM = 0x071000 /* 7.16.0 */
+   case CURLMOPT_PIPELINING:
+#endif
+#if LIBCURL_VERSION_NUM = 0x071003 /* 7.16.3 */
+   case CURLMOPT_MAXCONNECTS:
+#endif
+   convert_to_long_ex(zvalue);
+   error = curl_multi_setopt(mh-multi, option, 
Z_LVAL_PP(zvalue));
+   break;
+
+   default:
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
curl multi configuration option);
+   error = CURLM_UNKNOWN_OPTION;
+   break;
+   }
+
+   if (error != CURLM_OK) {
+   return 1;
+   } else {
+   return 0;
+   }
+}
+/* }}} */
+
+
+/* {{{ proto int curl_multi_setopt(resource mh, int option, mixed value)
+   Set an option for the curl multi handle */
+PHP_FUNCTION(curl_multi_setopt)
+{
+   zval   *z_mh, **zvalue;
+   longoptions;
+   php_curlm *mh;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rlZ, z_mh, 
options, zvalue) == FAILURE) {
+   return;
+   }
+
+   ZEND_FETCH_RESOURCE(mh, php_curlm *, z_mh, -1, 
le_curl_multi_handle_name, le_curl_multi_handle);
+
+   if (!_php_curl_multi_setopt(mh, options, zvalue, return_value 
TSRMLS_CC)) {
+   RETURN_TRUE;
+   } else {
+   RETURN_FALSE;
+   }
+}
+/* }}} */
+#endif
+
 #endif
 
 /*
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 02eb24e..d00b431 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -91,6 +91,8 @@ PHP_FUNCTION(curl_reset);
 #if LIBCURL_VERSION_NUM = 0x070f04 /* 7.15.4 */
 PHP_FUNCTION(curl_escape);
 PHP_FUNCTION(curl_unescape);
+
+PHP_FUNCTION(curl_multi_setopt);
 #endif
 
 void _php_curl_multi_close(zend_rsrc_list_entry * TSRMLS_DC);
diff --git a/ext/curl/share.c b/ext/curl/share.c
index d7cec23..70e2f56 100644
--- a/ext/curl/share.c
+++ b/ext/curl/share.c
@@ -76,9 +76,14 @@ static int 

[PHP-CVS] com php-src: Remove duplicated function definition: ext/curl/php_curl.h

2012-12-23 Thread Pierrick Charron
Commit:ded889e865825b41e9484a47bfbcbd4b6ed15d50
Author:Pierrick Charron pierr...@php.net Sun, 23 Dec 2012 
14:05:04 -0500
Parents:   ee453541ed5b7d1dc3dd96e3a9af4bfc9ae75956
Branches:  PHP-5.5 master

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

Log:
Remove duplicated function definition

Changed paths:
  M  ext/curl/php_curl.h


Diff:
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 0a272fa..02eb24e 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -59,35 +59,29 @@ extern int  le_curl_share_handle;
 PHP_MINIT_FUNCTION(curl);
 PHP_MSHUTDOWN_FUNCTION(curl);
 PHP_MINFO_FUNCTION(curl);
-PHP_FUNCTION(curl_version);
-PHP_FUNCTION(curl_init);
+
+PHP_FUNCTION(curl_close);
 PHP_FUNCTION(curl_copy_handle);
-PHP_FUNCTION(curl_setopt);
-PHP_FUNCTION(curl_setopt_array);
+PHP_FUNCTION(curl_errno);
+PHP_FUNCTION(curl_error);
 PHP_FUNCTION(curl_exec);
 PHP_FUNCTION(curl_getinfo);
-PHP_FUNCTION(curl_error);
-PHP_FUNCTION(curl_errno);
-PHP_FUNCTION(curl_close);
-
-#if LIBCURL_VERSION_NUM = 0x070c01 /* 7.12.1 */
-PHP_FUNCTION(curl_reset);
-#endif
-#if LIBCURL_VERSION_NUM  0x070f03 /* 7.15.4 */
-PHP_FUNCTION(curl_escape);
-PHP_FUNCTION(curl_unescape);
-#endif
+PHP_FUNCTION(curl_init);
+PHP_FUNCTION(curl_setopt);
+PHP_FUNCTION(curl_setopt_array);
+PHP_FUNCTION(curl_version);
 
-PHP_FUNCTION(curl_multi_init);
 PHP_FUNCTION(curl_multi_add_handle);
-PHP_FUNCTION(curl_multi_remove_handle);
-PHP_FUNCTION(curl_multi_select);
+PHP_FUNCTION(curl_multi_close);
 PHP_FUNCTION(curl_multi_exec);
 PHP_FUNCTION(curl_multi_getcontent);
 PHP_FUNCTION(curl_multi_info_read);
-PHP_FUNCTION(curl_multi_close);
-PHP_FUNCTION(curl_share_init);
+PHP_FUNCTION(curl_multi_init);
+PHP_FUNCTION(curl_multi_remove_handle);
+PHP_FUNCTION(curl_multi_select);
+
 PHP_FUNCTION(curl_share_close);
+PHP_FUNCTION(curl_share_init);
 PHP_FUNCTION(curl_share_setopt);
 
 #if LIBCURL_VERSION_NUM = 0x070c01 /* 7.12.1 */


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



Re: [PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/standard/tests/file/bug52820.phpt

2012-12-23 Thread Pierrick Charron
When merging you can specify that a file don't need to be on the
destination branch.

That's probably what Laurence did :)

Pierrick

On 23 December 2012 14:22, Ferenc Kovacs tyr...@gmail.com wrote:
 On Sun, Dec 23, 2012 at 7:21 PM, Pierrick Charron pierr...@php.net wrote:

 His commit was I think merged, what you're seeing in this merge is


 If it was merged then why is the testfile missing (causing your merge
 conflict)?

 --
 Ferenc Kovács
 @Tyr43l - http://tyrael.hu

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



[PHP-CVS] com php-src: Implement Generator::throw() method: NEWS Zend/tests/generators/throw_already_closed.phpt Zend/tests/generators/throw_caught.phpt Zend/tests/generators/throw_not_an_exception.ph

2012-12-23 Thread Nikita Popov
Commit:be7b0bc3ec02e4f223920ee6397f9c4993eb7df5
Author:Nikita Popov ni...@php.net Mon, 17 Dec 2012 22:02:32 +0100
Parents:   24f1ef1b0254d4b8341aa9d74ca450e89c2a8683
Branches:  PHP-5.5 master

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

Log:
Implement Generator::throw() method

Generator::throw($exception) throws an exception into the generator. The
exception is thrown at the current point of suspension within the generator.
It basically behaves as if the current yield statement were replaced with
a throw statement and the generator subsequently resumed.

Changed paths:
  M  NEWS
  A  Zend/tests/generators/throw_already_closed.phpt
  A  Zend/tests/generators/throw_caught.phpt
  A  Zend/tests/generators/throw_not_an_exception.phpt
  A  Zend/tests/generators/throw_rethrow.phpt
  A  Zend/tests/generators/throw_uncaught.phpt
  M  Zend/zend_generators.c


Diff:
diff --git a/NEWS b/NEWS
index 54b4455..b8fb42b 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ PHP 
   NEWS
 - General improvements:
   . Fixed bug #63822 (Crash when using closures with ArrayAccess).
 (Nikita Popov)
+  . Add Generator::throw() method. (Nikita Popov)
 
 - cURL:
   . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror
diff --git a/Zend/tests/generators/throw_already_closed.phpt 
b/Zend/tests/generators/throw_already_closed.phpt
new file mode 100644
index 000..e918e54
--- /dev/null
+++ b/Zend/tests/generators/throw_already_closed.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Generator::throw() on an already closed generator
+--FILE--
+?php
+
+function gen() {
+yield;
+}
+
+$gen = gen();
+$gen-next();
+$gen-next();
+var_dump($gen-valid());
+$gen-throw(new Exception('test'));
+
+?
+--EXPECTF--
+bool(false)
+
+Fatal error: Uncaught exception 'Exception' with message 'test' in %s:%d
+Stack trace:
+#0 {main}
+  thrown in %s on line %d
diff --git a/Zend/tests/generators/throw_caught.phpt 
b/Zend/tests/generators/throw_caught.phpt
new file mode 100644
index 000..0c3f8e9
--- /dev/null
+++ b/Zend/tests/generators/throw_caught.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Generator::throw() where the exception is caught in the generator
+--FILE--
+?php
+
+function gen() {
+try {
+yield;
+} catch (RuntimeException $e) {
+echo $e, \n\n;
+}
+
+yield 'result';
+}
+
+$gen = gen();
+var_dump($gen-throw(new RuntimeException('Test')));
+
+?
+--EXPECTF--
+exception 'RuntimeException' with message 'Test' in %s:%d
+Stack trace:
+#0 {main}
+
+string(6) result
diff --git a/Zend/tests/generators/throw_not_an_exception.phpt 
b/Zend/tests/generators/throw_not_an_exception.phpt
new file mode 100644
index 000..d93903e
--- /dev/null
+++ b/Zend/tests/generators/throw_not_an_exception.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Generator::throw() with something that's not an exception
+--FILE--
+?php
+
+function gen() {
+yield;
+}
+
+$gen = gen();
+$gen-throw(new stdClass);
+
+?
+--EXPECTF--
+Fatal error: Exceptions must be valid objects derived from the Exception base 
class in %s on line %d
diff --git a/Zend/tests/generators/throw_rethrow.phpt 
b/Zend/tests/generators/throw_rethrow.phpt
new file mode 100644
index 000..267f5f0
--- /dev/null
+++ b/Zend/tests/generators/throw_rethrow.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Generator::throw() where the generator throws a different exception
+--FILE--
+?php
+
+function gen() {
+try {
+yield;
+} catch (RuntimeException $e) {
+echo 'Caught: ', $e, \n\n;
+
+throw new LogicException('new throw');
+}
+}
+
+$gen = gen();
+var_dump($gen-throw(new RuntimeException('throw')));
+
+?
+--EXPECTF--
+Caught: exception 'RuntimeException' with message 'throw' in %s:%d
+Stack trace:
+#0 {main}
+
+
+Fatal error: Uncaught exception 'LogicException' with message 'new throw' in 
%s:%d
+Stack trace:
+#0 [internal function]: gen()
+#1 %s(%d): Generator-throw(Object(RuntimeException))
+#2 {main}
+  thrown in %s on line %d
+
diff --git a/Zend/tests/generators/throw_uncaught.phpt 
b/Zend/tests/generators/throw_uncaught.phpt
new file mode 100644
index 000..f06cff1
--- /dev/null
+++ b/Zend/tests/generators/throw_uncaught.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Generator::throw() where the exception is not caught in the generator
+--FILE--
+?php
+
+function gen() {
+yield 'thisThrows';
+yield 'notReached';
+}
+
+$gen = gen();
+var_dump($gen-throw(new RuntimeException('test')));
+
+?
+--EXPECTF--
+Fatal error: Uncaught exception 'RuntimeException' with message 'test' in %s:%d
+Stack trace:
+#0 {main}
+  thrown in %s on line %d
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index b16687c..9c65c53 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -431,10 +431,6 @@ static zend_function *zend_generator_get_constructor(zval 
*object TSRMLS_DC) /*
 
 ZEND_API void zend_generator_resume(zend_generator *generator