[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-01 Thread Felipe Pena
felipe   Wed, 01 Sep 2010 23:21:03 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302985

Log:
- Fixed compiler warning (missing return statement)

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 22:59:25 UTC (rev 
302984)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 23:21:03 UTC (rev 
302985)
@@ -1445,6 +1445,7 @@
if (!req) return NULL;
if (val == NULL) {
fcgi_hash_del(&req->env, FCGI_HASH_FUNC(var, var_len), var, 
var_len);
+   return NULL;
} else {
return fcgi_hash_set(&req->env, FCGI_HASH_FUNC(var, var_len), 
var, var_len, val, strlen(val));
}
@@ -1454,6 +1455,7 @@
 {
if (val == NULL) {
fcgi_hash_del(&req->env, hash_value, var, var_len);
+   return NULL;
} else {
return fcgi_hash_set(&req->env, hash_value, var, var_len, val, 
strlen(val));
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/intl/dateformat/dateformat_parse.c branches/PHP_5_3/ext/intl/tests/bug50590.phpt branches/PHP_5_3/ext/intl/tests/dateformat_form

2010-09-01 Thread Stanislav Malyshev
stas Wed, 01 Sep 2010 20:34:59 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302982

Log:
Fix bug #50590 - IntlDateFormatter::parse result is limited to the integer range

Bug: http://bugs.php.net/50590 (Assigned) IntlDateFormatter::parse result is 
limited to the integer range
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_parse.c
A   php/php-src/branches/PHP_5_3/ext/intl/tests/bug50590.phpt
U   php/php-src/branches/PHP_5_3/ext/intl/tests/dateformat_format_parse.phpt
U   
php/php-src/branches/PHP_5_3/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt
U   php/php-src/trunk/ext/intl/dateformat/dateformat_parse.c
A   php/php-src/trunk/ext/intl/tests/bug50590.phpt
U   php/php-src/trunk/ext/intl/tests/dateformat_format_parse.phpt
U   
php/php-src/trunk/ext/intl/tests/dateformat_parse_timestamp_parsepos.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2010-09-01 18:27:41 UTC (rev 302981)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-09-01 20:34:59 UTC (rev 302982)
@@ -64,6 +64,8 @@
 - Fixed bug #51610 (Using oci_connect causes PHP to take a long time to
   exit). Requires Oracle bug fix 9891199 for this patch to have an
   effect. (Oracle Corp.)
+- Fixed bug #50590 (IntlDateFormatter::parse result is limited to the integer
+  range). (Stas)
 - Fixed bug #50481 (Storing many SPLFixedArray in an array crashes). (Felipe)

 22 Jul 2010, PHP 5.3.3

Modified: php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_parse.c
===
--- php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_parse.c	2010-09-01 18:27:41 UTC (rev 302981)
+++ php/php-src/branches/PHP_5_3/ext/intl/dateformat/dateformat_parse.c	2010-09-01 20:34:59 UTC (rev 302982)
@@ -19,6 +19,7 @@
 #endif

 #include 
+#include 

 #include "php_intl.h"
 #include "intl_convert.h"
@@ -35,7 +36,7 @@
 */
 static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value TSRMLS_DC)
 {
-	long	result =  0;
+	double	result =  0;
 	UDate 	timestamp   =0;
 	UChar* 	text_utf16  = NULL;
 	int32_t text_utf16_len = 0;
@@ -52,12 +53,12 @@
 	INTL_METHOD_CHECK_STATUS( dfo, "Date parsing failed" );

 	/* Since return is in  sec. */
-	result = (long )( timestamp / 1000 );
-	if( result != (timestamp/1000) ) {
-		intl_error_set( NULL, U_BUFFER_OVERFLOW_ERROR,
-"datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle.\nThe valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.", 0 TSRMLS_CC );
+	result = (double)timestamp / U_MILLIS_PER_SECOND;
+	if(result > LONG_MAX || result < -LONG_MAX) {
+		ZVAL_DOUBLE(return_value, result<0?ceil(result):floor(result));
+	} else {
+		ZVAL_LONG(return_value, (long)result);
 	}
-	RETURN_LONG( result );
 }
 /* }}} */


Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug50590.phpt
===
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug50590.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug50590.phpt	2010-09-01 20:34:59 UTC (rev 302982)
@@ -0,0 +1,13 @@
+--TEST--
+Bug #50590 (IntlDateFormatter::parse result is limited to the integer range)
+--SKIPIF--
+
+--FILE--
+parse("Wednesday, January 20, 2038 3:14:07 AM GMT"));
+
+?>
+--EXPECTF--
+float(2147570047)

Modified: php/php-src/branches/PHP_5_3/ext/intl/tests/dateformat_format_parse.phpt
===
--- php/php-src/branches/PHP_5_3/ext/intl/tests/dateformat_format_parse.phpt	2010-09-01 18:27:41 UTC (rev 302981)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/dateformat_format_parse.phpt	2010-09-01 20:34:59 UTC (rev 302982)
@@ -187,16 +187,13 @@

 IntlDateFormatter locale= en_US ,datetype = 0 ,timetype =0
 Formatted timestamp is : Monday, September 19, 2039 4:06:40 AM GMT+05:00
-Error while parsing as: 'datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle.
-The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.: U_BUFFER_OVERFLOW_ERROR'
+Parsed timestamp is : 22
 IntlDateFormatter locale= en_US ,datetype = 1 ,timetype =1
 Formatted timestamp is : September 19, 2039 4:06:40 AM GMT+05:00
-Error while parsing as: 'datefmt_parse: parsing of input parametrs resulted in value larger than data type long can handle.
-The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT.: U_BUFFER_OVERFLOW_ERROR'
+Parsed timestamp is : 22
 IntlD

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Pierre Joye
hi,

Yes, understood that. I only pointed you to a place where you can get
this value per platform/arch tuple on windows.

On Wed, Sep 1, 2010 at 10:00 PM, Andrey Hristov  wrote:
> I need to keep the ABI. Currently it is char*, which will be 4 bytes on
> 32bit, and 8 bytes on 64bit. Therefore, I needed this macro to put the right
> amount of bytes - uint32_t or uint64_t . Anyway, currently this is unused
> and can stay as char *. I will look for a solution when I needed to use
> these members.
> Thanks for the help offered.
>
> Andrey
>
> Pierre Joye wrote:
>>
>> hi Andrey,
>>
>> See http://lxr.php.net/opengrok/xref/PHP_5_3/win32/php_stdint.h
>>
>> it has macros for integer capable to contain a pointer.
>>
>> Cheers,
>>
>> On Wed, Sep 1, 2010 at 6:54 PM, Andrey Hristov  wrote:
>>>
>>> andrey                                   Wed, 01 Sep 2010 16:54:20 +
>>>
>>> Revision: http://svn.php.net/viewvc?view=revision&revision=302980
>>>
>>> Log:
>>> fix build on windows, seems this macro is not defined
>>>
>>> Changed paths:
>>>   U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
>>>   U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
>>>
>>> Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
>>> ===
>>> --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
>>>  2010-09-01 15:34:48 UTC (rev 302979)
>>> +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
>>>  2010-09-01 16:54:20 UTC (rev 302980)
>>> @@ -156,13 +156,7 @@
>>>         The ABI will be broken and the methods structure will be
>>> somewhere else
>>>         in the memory which can crash external code. Feel free to reuse
>>> these.
>>>       */
>>> -#if SIZEOF_CHAR_P == 4
>>> -       uint32_t unused1;
>>> -#elif SIZEOF_CHAR_P == 8
>>> -       uint64_t unused1;
>>> -#else
>>> -#error Not supported platform
>>> -#endif
>>> +       char            * unused1;
>>>       char            * unused2;
>>>       char            * unused3;
>>>       char            * unused4;
>>>
>>> Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
>>> ===
>>> --- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01
>>> 15:34:48 UTC (rev 302979)
>>> +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01
>>> 16:54:20 UTC (rev 302980)
>>> @@ -156,13 +156,7 @@
>>>         The ABI will be broken and the methods structure will be
>>> somewhere else
>>>         in the memory which can crash external code. Feel free to reuse
>>> these.
>>>       */
>>> -#if SIZEOF_CHAR_P == 4
>>> -       uint32_t unused1;
>>> -#elif SIZEOF_CHAR_P == 8
>>> -       uint64_t unused1;
>>> -#else
>>> -#error Not supported platform
>>> -#endif
>>> +       char            * unused1;
>>>       char            * unused2;
>>>       char            * unused3;
>>>       char            * unused4;
>>>
>>>
>>> --
>>> 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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Andrey Hristov
I need to keep the ABI. Currently it is char*, which will be 4 bytes on 
32bit, and 8 bytes on 64bit. Therefore, I needed this macro to put the 
right amount of bytes - uint32_t or uint64_t . Anyway, currently this is 
unused and can stay as char *. I will look for a solution when I needed 
to use these members.

Thanks for the help offered.

Andrey

Pierre Joye wrote:

hi Andrey,

See http://lxr.php.net/opengrok/xref/PHP_5_3/win32/php_stdint.h

it has macros for integer capable to contain a pointer.

Cheers,

On Wed, Sep 1, 2010 at 6:54 PM, Andrey Hristov  wrote:

andrey   Wed, 01 Sep 2010 16:54:20 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302980

Log:
fix build on windows, seems this macro is not defined

Changed paths:
   U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
   U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
15:34:48 UTC (rev 302979)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
16:54:20 UTC (rev 302980)
@@ -156,13 +156,7 @@
 The ABI will be broken and the methods structure will be somewhere else
 in the memory which can crash external code. Feel free to reuse these.
   */
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
   char* unused2;
   char* unused3;
   char* unused4;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 15:34:48 UTC 
(rev 302979)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 16:54:20 UTC 
(rev 302980)
@@ -156,13 +156,7 @@
 The ABI will be broken and the methods structure will be somewhere else
 in the memory which can crash external code. Feel free to reuse these.
   */
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
   char* unused2;
   char* unused3;
   char* unused4;


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








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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Pierre Joye
hi Andrey,

See http://lxr.php.net/opengrok/xref/PHP_5_3/win32/php_stdint.h

it has macros for integer capable to contain a pointer.

Cheers,

On Wed, Sep 1, 2010 at 6:54 PM, Andrey Hristov  wrote:
> andrey                                   Wed, 01 Sep 2010 16:54:20 +
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=302980
>
> Log:
> fix build on windows, seems this macro is not defined
>
> Changed paths:
>    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
>    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
>
> Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
> ===
> --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
> 15:34:48 UTC (rev 302979)
> +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
> 16:54:20 UTC (rev 302980)
> @@ -156,13 +156,7 @@
>          The ABI will be broken and the methods structure will be somewhere 
> else
>          in the memory which can crash external code. Feel free to reuse 
> these.
>        */
> -#if SIZEOF_CHAR_P == 4
> -       uint32_t unused1;
> -#elif SIZEOF_CHAR_P == 8
> -       uint64_t unused1;
> -#else
> -#error Not supported platform
> -#endif
> +       char            * unused1;
>        char            * unused2;
>        char            * unused3;
>        char            * unused4;
>
> Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
> ===
> --- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01 15:34:48 
> UTC (rev 302979)
> +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01 16:54:20 
> UTC (rev 302980)
> @@ -156,13 +156,7 @@
>          The ABI will be broken and the methods structure will be somewhere 
> else
>          in the memory which can crash external code. Feel free to reuse 
> these.
>        */
> -#if SIZEOF_CHAR_P == 4
> -       uint32_t unused1;
> -#elif SIZEOF_CHAR_P == 8
> -       uint64_t unused1;
> -#else
> -#error Not supported platform
> -#endif
> +       char            * unused1;
>        char            * unused2;
>        char            * unused3;
>        char            * unused4;
>
>
> --
> 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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Kalle Sommer Nielsen
Hi

2010/9/1 Andrey Hristov :
> andrey                                   Wed, 01 Sep 2010 16:54:20 +
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=302980
>
> Log:
> fix build on windows, seems this macro is not defined
>

Wouldn't it be easier to just define SIZEOF_CHAR_P to 4 in
config.w32.h.in as it default is?

Something like:
size_t sizeof_ptr(char *ptr)
{
return sizeof(ptr);
}

and test like:
char test = "Something something";
size_t test_size = sizeof_ptr(test);

Guess it could be done better or staticlly :)

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Andrey Hristov
andrey   Wed, 01 Sep 2010 16:54:20 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302980

Log:
fix build on windows, seems this macro is not defined

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
15:34:48 UTC (rev 302979)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
16:54:20 UTC (rev 302980)
@@ -156,13 +156,7 @@
  The ABI will be broken and the methods structure will be somewhere 
else
  in the memory which can crash external code. Feel free to reuse these.
*/
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
char* unused2;
char* unused3;
char* unused4;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 15:34:48 UTC 
(rev 302979)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 16:54:20 UTC 
(rev 302980)
@@ -156,13 +156,7 @@
  The ABI will be broken and the methods structure will be somewhere 
else
  in the memory which can crash external code. Feel free to reuse these.
*/
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
char* unused2;
char* unused3;
char* unused4;

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

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ cgi_main.c fastcgi.c fastcgi.h

2010-09-01 Thread Dmitry Stogov
dmitry   Wed, 01 Sep 2010 15:34:48 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302979

Log:
Reduced overhead of FastCGI using near-perfect hash function and predcalculated 
hash values.

Changed paths:
U   php/php-src/trunk/sapi/cgi/cgi_main.c
U   php/php-src/trunk/sapi/cgi/fastcgi.c
U   php/php-src/trunk/sapi/cgi/fastcgi.h

Modified: php/php-src/trunk/sapi/cgi/cgi_main.c
===
--- php/php-src/trunk/sapi/cgi/cgi_main.c	2010-09-01 14:47:36 UTC (rev 302978)
+++ php/php-src/trunk/sapi/cgi/cgi_main.c	2010-09-01 15:34:48 UTC (rev 302979)
@@ -267,41 +267,30 @@
 #define STDOUT_FILENO 1
 #endif

-static inline size_t sapi_cgibin_single_write(const char *str, uint str_length TSRMLS_DC)
+static inline size_t sapi_cgi_single_write(const char *str, uint str_length TSRMLS_DC)
 {
 #ifdef PHP_WRITE_STDOUT
 	long ret;
-#else
-	size_t ret;
-#endif

-	if (fcgi_is_fastcgi()) {
-		fcgi_request *request = (fcgi_request*) SG(server_context);
-		long ret = fcgi_write(request, FCGI_STDOUT, str, str_length);
-		if (ret <= 0) {
-			return 0;
-		}
-		return ret;
-	}
-
-#ifdef PHP_WRITE_STDOUT
 	ret = write(STDOUT_FILENO, str, str_length);
 	if (ret <= 0) return 0;
 	return ret;
 #else
+	size_t ret;
+
 	ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
 	return ret;
 #endif
 }

-static int sapi_cgibin_ub_write(const char *str, uint str_length TSRMLS_DC)
+static int sapi_cgi_ub_write(const char *str, uint str_length TSRMLS_DC)
 {
 	const char *ptr = str;
 	uint remaining = str_length;
 	size_t ret;

 	while (remaining > 0) {
-		ret = sapi_cgibin_single_write(ptr, remaining TSRMLS_CC);
+		ret = sapi_cgi_single_write(ptr, remaining TSRMLS_CC);
 		if (!ret) {
 			php_handle_aborted_connection();
 			return str_length - remaining;
@@ -313,21 +302,43 @@
 	return str_length;
 }

+static int sapi_fcgi_ub_write(const char *str, uint str_length TSRMLS_DC)
+{
+	const char *ptr = str;
+	uint remaining = str_length;
+	fcgi_request *request = (fcgi_request*) SG(server_context);

-static void sapi_cgibin_flush(void *server_context)
+	while (remaining > 0) {
+		long ret = fcgi_write(request, FCGI_STDOUT, ptr, remaining);
+
+		if (ret <= 0) {
+			php_handle_aborted_connection();
+			return str_length - remaining;
+		}
+		ptr += ret;
+		remaining -= ret;
+	}
+
+	return str_length;
+}
+
+static void sapi_cgi_flush(void *server_context)
 {
-	if (fcgi_is_fastcgi()) {
-		fcgi_request *request = (fcgi_request*) server_context;
-		if (
+	if (fflush(stdout) == EOF) {
+		php_handle_aborted_connection();
+	}
+}
+
+static void sapi_fcgi_flush(void *server_context)
+{
+	fcgi_request *request = (fcgi_request*) server_context;
+
+	if (
 #ifndef PHP_WIN32
 		!parent &&
 #endif
 		request && !fcgi_flush(request, 0)) {
-			php_handle_aborted_connection();
-		}
-		return;
-	}
-	if (fflush(stdout) == EOF) {
+
 		php_handle_aborted_connection();
 	}
 }
@@ -493,12 +504,24 @@

 	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
 	while (read_bytes < count_bytes) {
-		if (fcgi_is_fastcgi()) {
-			fcgi_request *request = (fcgi_request*) SG(server_context);
-			tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
-		} else {
-			tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
+		tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
+		if (tmp_read_bytes <= 0) {
+			break;
 		}
+		read_bytes += tmp_read_bytes;
+	}
+	return read_bytes;
+}
+
+static int sapi_fcgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
+{
+	uint read_bytes = 0;
+	int tmp_read_bytes;
+	fcgi_request *request = (fcgi_request*) SG(server_context);
+
+	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+	while (read_bytes < count_bytes) {
+		tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
 		if (tmp_read_bytes <= 0) {
 			break;
 		}
@@ -507,43 +530,33 @@
 	return read_bytes;
 }

-static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC)
+static char *sapi_cgi_getenv(char *name, size_t name_len TSRMLS_DC)
 {
+	return getenv(name);
+}
+
+static char *sapi_fcgi_getenv(char *name, size_t name_len TSRMLS_DC)
+{
 	/* when php is started by mod_fastcgi, no regular environment
 	 * is provided to PHP.  It is always sent to PHP at the start
 	 * of a request.  So we have to do our own lookup to get env
 	 * vars.  This could probably be faster somehow.  */
-	if (fcgi_is_fastcgi()) {
-		fcgi_request *request = (fcgi_request*) SG(server_context);
-		return fcgi_getenv(request, name, name_len);
-	}
+	fcgi_request *request = (fcgi_request*) SG(server_context);
+	char *ret = fcgi_getenv(request, name, name_len);
+
+	if (ret) return ret;
 	/*  if cgi, or fastcgi and not found in fcgi env
 		check the regular environment */
 	return getenv(name);
 }

-static ch

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_st

2010-09-01 Thread Andrey Hristov
andrey   Wed, 01 Sep 2010 14:47:36 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302978

Log:
OPT_COMPRESS support for mysqlnd_conn::set_client_option
To be used by mysqli_options

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-01 14:42:43 UTC 
(rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-01 14:47:36 UTC 
(rev 302978)
@@ -714,6 +714,10 @@
if (mysql_flags & CLIENT_COMPRESS) {
mysql_flags &= ~CLIENT_COMPRESS;
}
+#else
+   if (conn->net->options.flags & MYSQLND_NET_FLAG_USE_COMPRESSION) {
+   mysql_flags |= CLIENT_COMPRESS;
+   }
 #endif
 #ifndef MYSQLND_SSL_SUPPORTED
if (mysql_flags & CLIENT_SSL) {
@@ -2034,9 +2038,7 @@
DBG_ENTER("mysqlnd_conn::set_client_option");
DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
switch (option) {
-#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_COMPRESS:
-#endif
 #ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_READ_TIMEOUT:
case MYSQL_OPT_WRITE_TIMEOUT:

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-09-01 14:42:43 UTC (rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-09-01 14:47:36 UTC (rev 302978)
@@ -94,6 +94,9 @@

 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)

+
+#define MYSQLND_NET_FLAG_USE_COMPRESSION 1
+
 typedef enum mysqlnd_extension
 {
MYSQLND_MYSQL = 0,

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-09-01 
14:42:43 UTC (rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-09-01 
14:47:36 UTC (rev 302978)
@@ -665,10 +665,8 @@
net->options.timeout_write = *(unsigned int*) value;
break;
 #endif
-#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_COMPRESS:
-#endif
-   /* currently not supported. Todo!! */
+   net->options.flags |= MYSQLND_NET_FLAG_USE_COMPRESSION;
break;
default:
DBG_RETURN(FAIL);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
14:42:43 UTC (rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
14:47:36 UTC (rev 302978)
@@ -156,11 +156,18 @@
  The ABI will be broken and the methods structure will be somewhere 
else
  in the memory which can crash external code. Feel free to reuse these.
*/
-   char* unused1;
+#if SIZEOF_CHAR_P == 4
+   uint32_t unused1;
+#elif SIZEOF_CHAR_P == 8
+   uint64_t unused1;
+#else
+#error Not supported platform
+#endif
char* unused2;
char* unused3;
char* unused4;
char* unused5;
+
enum_mysqlnd_protocol_type protocol;

char*charset_name;
@@ -190,6 +197,7 @@
char*ssl_cipher;
char*ssl_passphrase;
zend_bool   ssl_verify_peer;
+   uint64_tflags;
 } MYSQLND_NET_OPTIONS;



Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-01 14:42:43 UTC (rev 
302977)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-01 14:47:36 UTC (rev 
302978)
@@ -714,6 +714,10 @@
if (mysql_flags & CLIENT_COMPRESS) {
mysql_flags &= ~CLIENT_COMPRESS;
}
+#else
+   if (conn->net->options.flags & MYSQLND_NET_FLAG_USE_COMPRESSION) {
+   mysql_flags |= CLIENT_COMPRESS;
+   }
 #endif
 #ifndef MYSQLND_SSL_SUPPORTED
if (mysql_flags & CLIENT_SSL) {
@@ -2034,9 +2038,7 @@
DBG_ENTER("mysqlnd_conn::set_client_option");
DBG_INF_FMT("conn=%llu option=%u", 

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ fastcgi.c

2010-09-01 Thread Dmitry Stogov
dmitry   Wed, 01 Sep 2010 14:42:43 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302977

Log:
invalid length

Changed paths:
U   php/php-src/trunk/sapi/cgi/fastcgi.c

Modified: php/php-src/trunk/sapi/cgi/fastcgi.c
===
--- php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 13:14:40 UTC (rev 
302976)
+++ php/php-src/trunk/sapi/cgi/fastcgi.c2010-09-01 14:42:43 UTC (rev 
302977)
@@ -1438,7 +1438,7 @@
if (val == NULL) {
fcgi_hash_del(&req->env, var, var_len);
} else {
-   return fcgi_hash_set(&req->env, var, var_len+1, val, 
strlen(val));
+   return fcgi_hash_set(&req->env, var, var_len, val, 
strlen(val));
}
}
return NULL;

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

[PHP-CVS] svn: /php/php-src/trunk/ UPGRADING

2010-09-01 Thread Pierre Joye
pajoye   Wed, 01 Sep 2010 10:23:58 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302972

Log:
- is_link note

Changed paths:
U   php/php-src/trunk/UPGRADING

Modified: php/php-src/trunk/UPGRADING
===
--- php/php-src/trunk/UPGRADING 2010-09-01 10:22:29 UTC (rev 302971)
+++ php/php-src/trunk/UPGRADING 2010-09-01 10:23:58 UTC (rev 302972)
@@ -204,7 +204,8 @@
 12. Windows support
 ===

--
+- is_link now works properly for symbolic links on Windows Vista
+  or later. Earlier systems do not support symbolic links.

 ===
 13. New in PHP X.Y:

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

[PHP-CVS] svn: /php/php-src/trunk/ UPGRADING

2010-09-01 Thread Pierre Joye
pajoye   Wed, 01 Sep 2010 10:22:29 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302971

Log:
- fix index

Changed paths:
U   php/php-src/trunk/UPGRADING

Modified: php/php-src/trunk/UPGRADING
===
--- php/php-src/trunk/UPGRADING 2010-09-01 10:16:48 UTC (rev 302970)
+++ php/php-src/trunk/UPGRADING 2010-09-01 10:22:29 UTC (rev 302971)
@@ -16,7 +16,8 @@
 8. Changes in SAPI support
 9. Changes in INI directives
 10. Syntax additions
-11. Windows support
+11. Syntax additions
+12. Windows support
 12. New in PHP X.Y:
  a. New libraries
  b. New extensions

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/main/streams/plain_wrapper.c trunk/main/streams/plain_wrapper.c

2010-09-01 Thread Pierre Joye
pajoye   Wed, 01 Sep 2010 10:16:48 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302970

Log:
- WS

Changed paths:
U   php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c
U   php/php-src/trunk/main/streams/plain_wrapper.c

Modified: php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c
===
--- php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c   2010-09-01 
10:13:46 UTC (rev 302969)
+++ php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c   2010-09-01 
10:16:48 UTC (rev 302970)
@@ -1147,7 +1147,7 @@
 #else
php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, 
"%s", strerror(errno));
 #endif
-return 0;
+   return 0;
}

/* Clear stat cache (and realpath cache) */
@@ -1229,7 +1229,7 @@
if (*p == '\0') {
*p = DEFAULT_SLASH;
if ((*(p+1) != '\0') &&
-   (ret = VCWD_MKDIR(buf, 
(mode_t)mode)) < 0) {
+   (ret = VCWD_MKDIR(buf, 
(mode_t)mode)) < 0) {
if (options & REPORT_ERRORS) {
php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "%s", strerror(errno));
}

Modified: php/php-src/trunk/main/streams/plain_wrapper.c
===
--- php/php-src/trunk/main/streams/plain_wrapper.c  2010-09-01 10:13:46 UTC 
(rev 302969)
+++ php/php-src/trunk/main/streams/plain_wrapper.c  2010-09-01 10:16:48 UTC 
(rev 302970)
@@ -1117,7 +1117,7 @@
 #else
php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, 
"%s", strerror(errno));
 #endif
-return 0;
+   return 0;
}

/* Clear stat cache (and realpath cache) */
@@ -1199,7 +1199,7 @@
if (*p == '\0') {
*p = DEFAULT_SLASH;
if ((*(p+1) != '\0') &&
-   (ret = VCWD_MKDIR(buf, 
(mode_t)mode)) < 0) {
+   (ret = VCWD_MKDIR(buf, 
(mode_t)mode)) < 0) {
if (options & REPORT_ERRORS) {
php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "%s", strerror(errno));
}

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/main/streams/ plain_wrapper.c

2010-09-01 Thread Pierre Joye
pajoye   Wed, 01 Sep 2010 10:13:46 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302969

Log:
- sb needed only in safemode

Changed paths:
U   php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c

Modified: php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c
===
--- php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c   2010-09-01 
10:03:06 UTC (rev 302968)
+++ php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c   2010-09-01 
10:13:46 UTC (rev 302969)
@@ -1306,7 +1306,6 @@
char *pathbuf, *ptr, *end;
char *exec_fname;
char trypath[MAXPATHLEN];
-   struct stat sb;
php_stream *stream;
int path_length;
int filename_length;
@@ -1448,6 +1447,8 @@
}

if (PG(safe_mode)) {
+   struct stat sb;
+
if (VCWD_STAT(trypath, &sb) == 0) {
/* file exists ... check permission */
if ((php_check_safe_mode_include_dir(trypath 
TSRMLS_CC) == 0) ||

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

[PHP-CVS] svn: /php/php-src/trunk/ UPGRADING.INTERNALS

2010-09-01 Thread Pierre Joye
pajoye   Wed, 01 Sep 2010 09:54:45 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302967

Log:
- upgrading addition about stat/lstat

Changed paths:
U   php/php-src/trunk/UPGRADING.INTERNALS

Modified: php/php-src/trunk/UPGRADING.INTERNALS
===
--- php/php-src/trunk/UPGRADING.INTERNALS   2010-09-01 09:49:53 UTC (rev 
302966)
+++ php/php-src/trunk/UPGRADING.INTERNALS   2010-09-01 09:54:45 UTC (rev 
302967)
@@ -8,6 +8,15 @@
 1. Internal API changes
 

+   a. virtual_file_ex
+
 virtual_file_ex takes now a TSRM context as last parameter:
 CWD_API int virtual_file_ex(cwd_state *state, const char *path,
  verify_path_func verify_path, int use_realpath TSRLS_DC);
+
+   b. stat/lstat support
+
+php_sys_lstat is now available on all platforms. On unix-like platform
+php_sys_lstat is an alias to lstat (when avaible). On Windows it is now
+available using php_sys_lstat. php_sys_stat and php_sys_lstat usage is 
recommended
+instead of calling lstat directly, to ensure portability.

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h branches/PHP_5_3/main/streams/plain_wrapper.c branches/PHP_5_3/main/win95nt.h trunk/TSRM/

2010-09-01 Thread Pierre Joye
pajoye   Wed, 01 Sep 2010 09:49:53 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302966

Log:
- add lstat support for Windows

Changed paths:
U   php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
U   php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h
U   php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c
U   php/php-src/branches/PHP_5_3/main/win95nt.h
U   php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
U   php/php-src/trunk/TSRM/tsrm_virtual_cwd.h
U   php/php-src/trunk/main/streams/plain_wrapper.c
U   php/php-src/trunk/main/streams/streams.c
U   php/php-src/trunk/main/win95nt.h

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
===
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c	2010-09-01 08:17:18 UTC (rev 302965)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c	2010-09-01 09:49:53 UTC (rev 302966)
@@ -14,6 +14,7 @@
+--+
| Authors: Andi Gutmans |
|  Sascha Schumann |
+   |  Pierre Joye |
+--+
 */

@@ -40,6 +41,10 @@
 # endif
 #endif

+#ifndef S_IFLNK
+# define S_IFLNK 012
+#endif
+
 #ifdef NETWARE
 #include 
 #endif
@@ -202,7 +207,7 @@
 	return (time_t)UnixTime;
 }

-CWD_API int php_sys_stat(const char *path, struct stat *buf) /* {{{ */
+CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */
 {
 	WIN32_FILE_ATTRIBUTE_DATA data;
 	__int64 t;
@@ -247,9 +252,46 @@
 			free(tmp);
 		}
 	}
+
 	buf->st_uid = buf->st_gid = buf->st_ino = 0;
-	buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG;
-	buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
+
+	if (lstat && data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+		/* File is a reparse point. Get the target */
+		HANDLE hLink = NULL;
+		REPARSE_DATA_BUFFER * pbuffer;
+		unsigned int retlength = 0;
+		TSRM_ALLOCA_FLAG(use_heap_large);
+
+		hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
+		if(hLink == INVALID_HANDLE_VALUE) {
+			return -1;
+		}
+
+		pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
+		if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer,  MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
+			tsrm_free_alloca(pbuffer, use_heap_large);
+			CloseHandle(hLink);
+			return -1;
+		}
+
+		CloseHandle(hLink);
+
+		if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
+			buf->st_mode = S_IFLNK;
+			buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
+		}
+
+#if 0 /* Not used yet */
+		else if(pbuffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
+			buf->st_mode |=;
+		}
+#endif
+		tsrm_free_alloca(pbuffer, use_heap_large);
+	} else {
+		buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG;
+		buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
+	}
+
 	if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
 		int len = strlen(path);

@@ -715,8 +757,8 @@
 		memcpy(tmp, path, len+1);

 		if(save &&
-		!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
-		(data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
+!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
+(data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
 			/* File is a reparse point. Get the target */
 			HANDLE hLink = NULL;
 			REPARSE_DATA_BUFFER * pbuffer;
@@ -1209,7 +1251,7 @@

 	if (length == 0) {
 		return 1; /* Can't cd to empty string */
-	}
+	}
 	while(--length >= 0 && !IS_SLASH(path[length])) {
 	}

@@ -1558,7 +1600,6 @@
 }
 /* }}} */

-#if !defined(TSRM_WIN32)
 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
 {
 	cwd_state new_state;
@@ -1570,13 +1611,12 @@
 		return -1;
 	}

-	retval = lstat(new_state.cwd, buf);
+	retval = php_sys_lstat(new_state.cwd, buf);

 	CWD_STATE_FREE(&new_state);
 	return retval;
 }
 /* }}} */
-#endif

 CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */
 {

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h
===
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h	

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/sapi/fpm/config.m4 branches/PHP_5_3/sapi/fpm/fpm/fpm_atomic.h trunk/sapi/fpm/config.m4 trunk/sapi/fpm/fpm/fpm_atomic.h

2010-09-01 Thread Jérôme Loyet
fat  Wed, 01 Sep 2010 08:17:18 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302965

Log:
- Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they 
were not available).

Bug: http://bugs.php.net/52725 (Analyzed) gcc builtin atomic functions are 
sometimes used when they are not available
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/sapi/fpm/config.m4
U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_atomic.h
U   php/php-src/trunk/sapi/fpm/config.m4
U   php/php-src/trunk/sapi/fpm/fpm/fpm_atomic.h

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-09-01 02:34:15 UTC (rev 302964)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-09-01 08:17:18 UTC (rev 302965)
@@ -17,6 +17,8 @@
 - Fixed possible crash in mssql_fetch_batch(). (Kalle)
 - Fixed inconsistent backlog default value (-1) in FPM on many systems. (fat)

+- Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they
+  were not available). (fat)
 - Fixed bug #52745 (Binding params doesn't work when selecting a date inside a
   CASE-WHEN). (Andrey)
 - Fixed bug #52699 (PDO bindValue writes long int 32bit enum).

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/config.m4
===
--- php/php-src/branches/PHP_5_3/sapi/fpm/config.m4 2010-09-01 02:34:15 UTC 
(rev 302964)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/config.m4 2010-09-01 08:17:18 UTC 
(rev 302965)
@@ -499,6 +499,24 @@
   fi

 ])
+
+AC_DEFUN([AC_FPM_BUILTIN_ATOMIC],
+[
+  AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
+  AC_TRY_LINK(,
+  [
+int variable = 1;
+return (__sync_bool_compare_and_swap(&variable, 1, 2)
+   && __sync_add_and_fetch(&variable, 1)) ? 1 : 0;
+  ],
+  [
+AC_MSG_RESULT([yes])
+AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports 
__sync_bool_compare_and_swap() a.o.])
+  ],
+  [
+AC_MSG_RESULT([no])
+  ])
+])
 dnl }}}

 AC_MSG_CHECKING(for FPM build)
@@ -518,6 +536,7 @@
   AC_FPM_PRCTL
   AC_FPM_CLOCK
   AC_FPM_TRACE
+  AC_FPM_BUILTIN_ATOMIC

   PHP_ARG_WITH(fpm-user,,
   [  --with-fpm-user[=USER]  Set the user for php-fpm to run as. (default: 
nobody)], nobody, no)

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_atomic.h
===
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_atomic.h  2010-09-01 
02:34:15 UTC (rev 302964)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_atomic.h  2010-09-01 
08:17:18 UTC (rev 302965)
@@ -12,7 +12,7 @@
 #endif
 #include 

-#if (__GNUC__) && (__GNUC__ >= 4 &&  __GNUC_MINOR__ >= 1)
+#ifdef HAVE_BUILTIN_ATOMIC

 /**
  * all the cases below (as provided by upstream) define:

Modified: php/php-src/trunk/sapi/fpm/config.m4
===
--- php/php-src/trunk/sapi/fpm/config.m42010-09-01 02:34:15 UTC (rev 
302964)
+++ php/php-src/trunk/sapi/fpm/config.m42010-09-01 08:17:18 UTC (rev 
302965)
@@ -499,6 +499,24 @@
   fi

 ])
+
+AC_DEFUN([AC_FPM_BUILTIN_ATOMIC],
+[
+  AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
+  AC_TRY_LINK(,
+  [
+int variable = 1;
+return (__sync_bool_compare_and_swap(&variable, 1, 2)
+   && __sync_add_and_fetch(&variable, 1)) ? 1 : 0;
+  ],
+  [
+AC_MSG_RESULT([yes])
+AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports 
__sync_bool_compare_and_swap() a.o.])
+  ],
+  [
+AC_MSG_RESULT([no])
+  ])
+])
 dnl }}}

 AC_MSG_CHECKING(for FPM build)
@@ -518,6 +536,7 @@
   AC_FPM_PRCTL
   AC_FPM_CLOCK
   AC_FPM_TRACE
+  AC_FPM_BUILTIN_ATOMIC

   PHP_ARG_WITH(fpm-user,,
   [  --with-fpm-user[=USER]  Set the user for php-fpm to run as. (default: 
nobody)], nobody, no)

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_atomic.h
===
--- php/php-src/trunk/sapi/fpm/fpm/fpm_atomic.h 2010-09-01 02:34:15 UTC (rev 
302964)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_atomic.h 2010-09-01 08:17:18 UTC (rev 
302965)
@@ -12,7 +12,7 @@
 #endif
 #include 

-#if (__GNUC__) && (__GNUC__ >= 4 &&  __GNUC_MINOR__ >= 1)
+#ifdef HAVE_BUILTIN_ATOMIC

 /**
  * all the cases below (as provided by upstream) define:

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