[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/pgsql pgsql.c

2007-09-03 Thread Ilia Alshanetsky
iliaa   Mon Sep  3 15:36:05 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/pgsql  pgsql.c 
  Log:
  
  Fixed bug #42506 (php_pgsql_convert() timezone parse bug)
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.924&r2=1.2027.2.547.2.925&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.924 php-src/NEWS:1.2027.2.547.2.925
--- php-src/NEWS:1.2027.2.547.2.924 Mon Sep  3 02:53:56 2007
+++ php-src/NEWSMon Sep  3 15:36:04 2007
@@ -6,6 +6,8 @@
 
 - Fixed bug #42512 (ip2long('255.255.255.255') should return 4294967295 on
   64-bit PHP). (Derick)
+- Fixed bug #42506 (php_pgsql_convert() timezone parse bug) (nonunnet at
+  gmail dot com, Ilia)
 - Fixed bug #42462 (Segmentation when trying to set an attribute in a 
   DOMElement). (Rob)
 - Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline
http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.22&r2=1.331.2.13.2.23&diff_format=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.22 
php-src/ext/pgsql/pgsql.c:1.331.2.13.2.23
--- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.22   Wed Aug 22 22:40:29 2007
+++ php-src/ext/pgsql/pgsql.c   Mon Sep  3 15:36:04 2007
@@ -20,7 +20,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.331.2.13.2.22 2007/08/22 22:40:29 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.331.2.13.2.23 2007/09/03 15:36:04 iliaa Exp $ */
 
 #include 
 
@@ -5001,7 +5001,7 @@
ZVAL_STRINGL(new_val, 
"NOW()", sizeof("NOW()")-1, 1);
} else {
/* FIXME: better regex 
must be used */
-   if 
(php_pgsql_convert_match(Z_STRVAL_PP(val), 
"^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ 
\\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ 
\\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$", 1 
TSRMLS_CC) == FAILURE) {
+   if 
(php_pgsql_convert_match(Z_STRVAL_PP(val), 
"^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ 
\\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ 
\\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 
TSRMLS_CC) == FAILURE) {
err = 1;
} else {

ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);

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



[PHP-CVS] cvs: php-src /ext/gd/libgd gd.c

2007-09-03 Thread Nuno Lopes
nlopess Mon Sep  3 14:34:42 2007 UTC

  Modified files:  
/php-src/ext/gd/libgd   gd.c 
  Log:
  MFB: malloc+memset == calloc
  # this was sitting here for quite a looong time..
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.111&r2=1.112&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.111 php-src/ext/gd/libgd/gd.c:1.112
--- php-src/ext/gd/libgd/gd.c:1.111 Sun Aug 26 20:33:21 2007
+++ php-src/ext/gd/libgd/gd.c   Mon Sep  3 14:34:42 2007
@@ -129,8 +129,8 @@
return NULL;
}
 
-   im = (gdImage *) gdMalloc(sizeof(gdImage));
-   memset(im, 0, sizeof(gdImage));
+   im = (gdImage *) gdCalloc(1, sizeof(gdImage));
+
/* Row-major ever since gd 1.3 */
im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * 
sy);

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



[PHP-CVS] cvs: php-src /ext/date php_date.c

2007-09-03 Thread Derick Rethans
derick  Mon Sep  3 12:12:51 2007 UTC

  Modified files:  
/php-src/ext/date   php_date.c 
  Log:
  - Ugh, fix this properly.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.144&r2=1.145&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.144 php-src/ext/date/php_date.c:1.145
--- php-src/ext/date/php_date.c:1.144   Mon Sep  3 12:03:46 2007
+++ php-src/ext/date/php_date.c Mon Sep  3 12:12:51 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.144 2007/09/03 12:03:46 derick Exp $ */
+/* $Id: php_date.c,v 1.145 2007/09/03 12:12:51 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2316,7 +2316,7 @@
array_init(element);
add_ascii_assoc_long(element, "ts", tzobj->tz->trans[i]);
if (UG(unicode)) {
-   add_assoc_unicode(element, "time", (UChar*) 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
+   add_ascii_assoc_unicode(element, "time", (UChar*) 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
} else {
add_assoc_string(element, "time", 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
}

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



[PHP-CVS] cvs: php-src /ext/date php_date.c

2007-09-03 Thread Derick Rethans
derick  Mon Sep  3 12:03:46 2007 UTC

  Modified files:  
/php-src/ext/date   php_date.c 
  Log:
  - Fixed DateTimeZone::getTransitions().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.143&r2=1.144&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.143 php-src/ext/date/php_date.c:1.144
--- php-src/ext/date/php_date.c:1.143   Fri Jul 13 15:22:34 2007
+++ php-src/ext/date/php_date.c Mon Sep  3 12:03:46 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_date.c,v 1.143 2007/07/13 15:22:34 dmitry Exp $ */
+/* $Id: php_date.c,v 1.144 2007/09/03 12:03:46 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2315,7 +2315,11 @@
MAKE_STD_ZVAL(element);
array_init(element);
add_ascii_assoc_long(element, "ts", tzobj->tz->trans[i]);
-   add_ascii_assoc_string(element, "time", 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
+   if (UG(unicode)) {
+   add_assoc_unicode(element, "time", (UChar*) 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
+   } else {
+   add_assoc_string(element, "time", 
php_format_date(DATE_FORMAT_ISO8601, 13, tzobj->tz->trans[i], 0 TSRMLS_CC), 0);
+   }
add_ascii_assoc_long(element, "offset", 
tzobj->tz->type[tzobj->tz->trans_idx[i]].offset);
add_ascii_assoc_bool(element, "isdst",  
tzobj->tz->type[tzobj->tz->trans_idx[i]].isdst);
add_ascii_assoc_ascii_string(element, "abbr", 
&tzobj->tz->timezone_abbr[tzobj->tz->type[tzobj->tz->trans_idx[i]].abbr_idx], 
1);

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



[PHP-CVS] cvs: php-src /ext/standard file.c

2007-09-03 Thread Jani Taskinen
janiMon Sep  3 11:53:44 2007 UTC

  Modified files:  
/php-src/ext/standard   file.c 
  Log:
  MFB: Fixed bug #42468 (Write lock on file_get_contents fails when using a 
compression stream)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.498&r2=1.499&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.498 php-src/ext/standard/file.c:1.499
--- php-src/ext/standard/file.c:1.498   Mon Aug 13 08:14:03 2007
+++ php-src/ext/standard/file.c Mon Sep  3 11:53:43 2007
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.498 2007/08/13 08:14:03 jani Exp $ */
+/* $Id: file.c,v 1.499 2007/09/03 11:53:43 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -661,7 +661,7 @@
RETURN_FALSE;
}
 
-   if (flags & LOCK_EX && php_stream_lock(stream, LOCK_EX)) {
+   if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || 
php_stream_lock(stream, LOCK_EX))) {
php_stream_close(stream);
RETURN_FALSE;
}

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



Re: [PHP-CVS] cvs: php-src /ext/standard basic_functions.c /ext/standard/tests/network ip_x86_64.phpt

2007-09-03 Thread Marcus Boerger
Hello Derick,

Saturday, September 1, 2007, 8:37:27 PM, you wrote:

> derick  Sat Sep  1 18:37:27 2007 UTC

>   Added files: 
> /php-src/ext/standard/tests/network ip_x86_64.phpt 

>   Modified files:  
> /php-src/ext/standard   basic_functions.c 
>   Log:
>   - Fixed bug #42512 (ip2long('255.255.255.255') should return 4294967295 on
> 64-bit PHP).
>   
>   
> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.870&r2=1.871&diff_format=u
> Index: php-src/ext/standard/basic_functions.c
> diff -u php-src/ext/standard/basic_functions.c:1.870
> php-src/ext/standard/basic_functions.c:1.871
> --- php-src/ext/standard/basic_functions.c:1.870Fri Aug 31 10:45:54 
> 2007
> +++ php-src/ext/standard/basic_functions.c  Sat Sep  1 18:37:27 2007
> @@ -17,7 +17,7 @@
> +--+
>   */
>  
> -/* $Id: basic_functions.c,v 1.870 2007/08/31 10:45:54 jani Exp $ */
> +/* $Id: basic_functions.c,v 1.871 2007/09/01 18:37:27 derick Exp $ */
>  
>  #include "php.h"
>  #include "php_streams.h"
> @@ -4284,7 +4284,7 @@
>  */
> if (addr_len == sizeof("255.255.255.255") - 1 &&
> !memcmp(addr, "255.255.255.255", 
> sizeof("255.255.255.255") - 1)) {
> -   RETURN_LONG(-1);
> +   RETURN_LONG(0x);

A Comment would be nice why this is neither -1 nor ~0.

> }
> 
> RETURN_FALSE;

> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/network/ip_x86_64.phpt?view=markup&rev=1.1
> Index: php-src/ext/standard/tests/network/ip_x86_64.phpt
> +++ php-src/ext/standard/tests/network/ip_x86_64.phpt
> --TEST--
> ip2long() & long2ip() tests
> --SKIPIF--
>  if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only");
?>>
> --FILE--
>  $array = array(
> "127.0.0.1",
> "10.0.0.1",
> "255.255.255.255",
> "255.255.255.0",
> "0.0.0.0",
> "66.163.161.116",
> );

> foreach ($array as $ip) {
> var_dump($long = ip2long($ip));
> var_dump(long2ip($long));
> }

> var_dump(ip2long());
> var_dump(ip2long(""));
> var_dump(ip2long("777.777.777.777"));
> var_dump(ip2long("111.111.111.111"));
> var_dump(ip2long(array()));

> var_dump(long2ip());
> var_dump(long2ip(-11));
> var_dump(long2ip(""));
> var_dump(long2ip(array()));

> echo "Done\n";
?>>
> --EXPECTF-- 
> int(2130706433)
> string(9) "127.0.0.1"
> int(167772161)
> string(8) "10.0.0.1"
> int(4294967295)
> string(15) "255.255.255.255"
> int(4294967040)
> string(13) "255.255.255.0"
> int(0)
> string(7) "0.0.0.0"
> int(1118019956)
> string(14) "66.163.161.116"

> Warning: Wrong parameter count for ip2long() in %s on line %d
> NULL
> bool(false)
> bool(false)
> int(1869573999)

> Notice: Array to string conversion in %s on line %d
> bool(false)

> Warning: Wrong parameter count for long2ip() in %s on line %d
> NULL
> string(13) "255.254.82.80"
> string(7) "0.0.0.0"

> Notice: Array to string conversion in %s on line %d
> string(7) "0.0.0.0"
> Done




Best regards,
 Marcus

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