[PHP-CVS] cvs: php-src /ext/standard array.c php_array.h /ext/unicode collator.c config.m4 config.w32 php_unicode.h unicode.c

2006-03-26 Thread Derick Rethans
derick  Sun Mar 26 11:06:24 2006 UTC

  Added files: 
/php-src/ext/unicodecollator.c 

  Modified files:  
/php-src/ext/standard   array.c php_array.h 
/php-src/ext/unicodeconfig.m4 config.w32 php_unicode.h unicode.c 
  Log:
  - Implemented basic collation support. For some reason new Collator gives 
segfaults when the object's collation resource is used.
  - The following example shows what is implemented:
  
  ?php
  $orig = $strings = array(
  'côte',
  'cote',
  'côté',
  'coté',
  'fluße',
  'flüße',
  );
  
  echo German phonebook:\n;
  $c = collator_create( [EMAIL PROTECTED] );
  foreach($c-sort($strings) as $string) {
  echo $string, \n;
  }
  echo $c-getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
  ? With : Without,  french accent sorting order\n;
  
  echo \nFrench with options:\n;
  $c = collator_create( fr );
  $c-setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
  $c-setAttribute(Collator::CASE_LEVEL, Collator::ON);
  $c-setStrength(Collator::SECONDARY);
  foreach($c-sort($strings) as $string) {
  echo $string, \n;
  }
  echo $c-getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
  ? With : Without,  french accent sorting order\n;
  ?
  
  http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.346r2=1.347diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.346 php-src/ext/standard/array.c:1.347
--- php-src/ext/standard/array.c:1.346  Wed Mar 22 22:06:08 2006
+++ php-src/ext/standard/array.cSun Mar 26 11:06:24 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.346 2006/03/22 22:06:08 tony2001 Exp $ */
+/* $Id: array.c,v 1.347 2006/03/26 11:06:24 derick Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -60,11 +60,6 @@
 
 #define EXTR_REFS  0x100
 
-#define SORT_REGULAR   0
-#define SORT_NUMERIC   1
-#defineSORT_STRING 2
-#defineSORT_LOCALE_STRING  5
-
 #define SORT_DESC  3
 #define SORT_ASC   4
 
@@ -139,7 +134,7 @@
return SUCCESS;
 }
 
-static void set_compare_func(int sort_type TSRMLS_DC)
+PHPAPI void php_set_compare_func(int sort_type TSRMLS_DC)
 {
switch (sort_type) {
case SORT_NUMERIC:
@@ -241,7 +236,7 @@
}

target_hash = HASH_OF(array);
-   set_compare_func(sort_type TSRMLS_CC);
+   php_set_compare_func(sort_type TSRMLS_CC);

if (zend_hash_sort(target_hash, zend_qsort, array_reverse_key_compare, 
0 TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
@@ -263,7 +258,7 @@
}
 
target_hash = HASH_OF(array);
-   set_compare_func(sort_type TSRMLS_CC);
+   php_set_compare_func(sort_type TSRMLS_CC);

if (zend_hash_sort(target_hash, zend_qsort, array_key_compare, 0 
TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
@@ -346,7 +341,7 @@
  *
  * This is not correct any more, depends on what compare_func is set to.
  */
-static int array_data_compare(const void *a, const void *b TSRMLS_DC)
+PHPAPI int php_array_data_compare(const void *a, const void *b TSRMLS_DC)
 {
Bucket *f;
Bucket *s;
@@ -387,7 +382,7 @@
 
 static int array_reverse_data_compare(const void *a, const void *b TSRMLS_DC)
 {
-   return array_data_compare(a, b TSRMLS_CC)*-1;
+   return php_array_data_compare(a, b TSRMLS_CC)*-1;
 }
 
 static int array_natural_general_compare(const void *a, const void *b, int 
fold_case)
@@ -493,9 +488,9 @@
}

target_hash = HASH_OF(array);
-   set_compare_func(sort_type TSRMLS_CC);
+   php_set_compare_func(sort_type TSRMLS_CC);

-   if (zend_hash_sort(target_hash, zend_qsort, array_data_compare, 0 
TSRMLS_CC) == FAILURE) {
+   if (zend_hash_sort(target_hash, zend_qsort, php_array_data_compare, 0 
TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
}
RETURN_TRUE;
@@ -515,7 +510,7 @@
}

target_hash = HASH_OF(array);
-   set_compare_func(sort_type TSRMLS_CC);
+   php_set_compare_func(sort_type TSRMLS_CC);

if (zend_hash_sort(target_hash, zend_qsort, array_reverse_data_compare, 
0 TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
@@ -537,9 +532,9 @@
}

target_hash = HASH_OF(array);
-   set_compare_func(sort_type TSRMLS_CC);
+   php_set_compare_func(sort_type TSRMLS_CC);

-   if (zend_hash_sort(target_hash, zend_qsort, array_data_compare, 1 
TSRMLS_CC) == FAILURE) {
+   if (zend_hash_sort(target_hash, zend_qsort, php_array_data_compare, 1 
TSRMLS_CC) == FAILURE) {
RETURN_FALSE;
}
RETURN_TRUE;
@@ -559,7 +554,7 @@
}


[PHP-CVS] cvs: php-src(PHP_5_1) / NEWS /ext/standard http_fopen_wrapper.c

2006-03-26 Thread Ilia Alshanetsky
iliaa   Sun Mar 26 17:12:05 2006 UTC

  Modified files:  (Branch: PHP_5_1)
/php-src/ext/standard   http_fopen_wrapper.c 
/php-srcNEWS 
  Log:
  Fixed bug #36857 (Added support for partial content fetching to the HTTP
  streams wrapper).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.9r2=1.99.2.10diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.9 
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.10
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.9  Fri Jan 20 01:40:32 2006
+++ php-src/ext/standard/http_fopen_wrapper.c   Sun Mar 26 17:12:05 2006
@@ -19,7 +19,7 @@
|  Sara Golemon [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.99.2.9 2006/01/20 01:40:32 iliaa Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.99.2.10 2006/03/26 17:12:05 iliaa Exp $ */ 
 
 #include php.h
 #include php_globals.h
@@ -493,6 +493,7 @@
}
switch(response_code) {
case 200:
+   case 206: /* partial content */
case 302:
case 303:
case 301:
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.481r2=1.2027.2.482diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.481 php-src/NEWS:1.2027.2.482
--- php-src/NEWS:1.2027.2.481   Sun Mar 26 00:23:25 2006
+++ php-src/NEWSSun Mar 26 17:12:05 2006
@@ -13,6 +13,8 @@
 - Fixed SoapFault::getMessage(). (Dmitry)
 - Fixed bug #36859 (DOMElement crashes when calling __construct when 
   clone'ing). (Tony)
+- Fixed bug #36857 (Added support for partial content fetching to the HTTP
+  streams wrapper). (Ilia)
 - Fixed bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause 
   segfault). (Tony)
 - Fixed bug #36820 (Privileged connection with an Oracle password file fails). 

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



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

2006-03-26 Thread Ilia Alshanetsky
iliaa   Sun Mar 26 17:12:26 2006 UTC

  Modified files:  
/php-src/ext/standard   http_fopen_wrapper.c 
  Log:
  MFB51: Fixed bug #36857 (Added support for partial content fetching to the 
  HTTP streams wrapper).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.111r2=1.112diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.111 
php-src/ext/standard/http_fopen_wrapper.c:1.112
--- php-src/ext/standard/http_fopen_wrapper.c:1.111 Thu Mar  2 13:12:45 2006
+++ php-src/ext/standard/http_fopen_wrapper.c   Sun Mar 26 17:12:26 2006
@@ -19,7 +19,7 @@
|  Sara Golemon [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.111 2006/03/02 13:12:45 dmitry Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.112 2006/03/26 17:12:26 iliaa Exp $ */ 
 
 #include php.h
 #include php_globals.h
@@ -493,6 +493,7 @@
}
switch(response_code) {
case 200:
+   case 206: /* partial content */
case 302:
case 303:
case 301:

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



[PHP-CVS] cvs: php-src(PHP_4_4) / NEWS /ext/standard http_fopen_wrapper.c

2006-03-26 Thread Ilia Alshanetsky
iliaa   Sun Mar 26 17:12:57 2006 UTC

  Modified files:  (Branch: PHP_4_4)
/php-src/ext/standard   http_fopen_wrapper.c 
/php-srcNEWS 
  Log:
  MFH: Fixed bug #36857 (Added support for partial content fetching to the 
  HTTP streams wrapper).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.53.2.20.2.6r2=1.53.2.20.2.7diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.53.2.20.2.6 
php-src/ext/standard/http_fopen_wrapper.c:1.53.2.20.2.7
--- php-src/ext/standard/http_fopen_wrapper.c:1.53.2.20.2.6 Sun Jan 15 
22:01:47 2006
+++ php-src/ext/standard/http_fopen_wrapper.c   Sun Mar 26 17:12:57 2006
@@ -18,7 +18,7 @@
|  Wez Furlong [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.53.2.20.2.6 2006/01/15 22:01:47 tony2001 Exp 
$ */ 
+/* $Id: http_fopen_wrapper.c,v 1.53.2.20.2.7 2006/03/26 17:12:57 iliaa Exp $ 
*/ 
 
 #include php.h
 #include php_globals.h
@@ -353,6 +353,7 @@
}
switch(response_code) {
case 200:
+   case 206: /* partial content */
case 302:
case 301:
reqok = 1;
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.1247.2.920.2.122r2=1.1247.2.920.2.123diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.122 php-src/NEWS:1.1247.2.920.2.123
--- php-src/NEWS:1.1247.2.920.2.122 Sat Mar 18 11:51:52 2006
+++ php-src/NEWSSun Mar 26 17:12:57 2006
@@ -4,6 +4,8 @@
 - Updated PCRE to version 6.6. (Andrei)
 - Added overflow checks to wordwrap() function. (Ilia)
 - Added a check for special characters in the session name. (Ilia)
+- Fixed bug #36857 (Added support for partial content fetching to the HTTP
+  streams wrapper). (Ilia)
 - Fixed bug #36776 (node_list_wrapper_dtor segfault). (Rob)
 - Fixed bug #36459 (Incorrect adding PHPSESSID to links, which contains \r\n).
   (Ilia)

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



[PHP-CVS] cvs: php-src(PHP_5_1) /ext/mysqli mysqli_api.c

2006-03-26 Thread Andrey Hristov
andrey  Sun Mar 26 21:08:41 2006 UTC

  Modified files:  (Branch: PHP_5_1)
/php-src/ext/mysqli mysqli_api.c 
  Log:
  remove unnecessary memcpy, cast directly
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.19r2=1.118.2.20diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.19 
php-src/ext/mysqli/mysqli_api.c:1.118.2.20
--- php-src/ext/mysqli/mysqli_api.c:1.118.2.19  Fri Mar 24 09:32:24 2006
+++ php-src/ext/mysqli/mysqli_api.c Sun Mar 26 21:08:41 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.118.2.19 2006/03/24 09:32:24 georg Exp $ 
+  $Id: mysqli_api.c,v 1.118.2.20 2006/03/26 21:08:41 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -691,8 +691,7 @@
};
break;
case IS_DOUBLE:
-   memcpy(dval, 
stmt-result.buf[i].val, sizeof(dval));
-   
ZVAL_DOUBLE(stmt-result.vars[i], dval);
+   
ZVAL_DOUBLE(stmt-result.vars[i], *(double *)stmt-result.buf[i].val);
break;
case IS_STRING:
if 
(stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_LONGLONG) {

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



[PHP-CVS] cvs: php-src(PHP_5_1) /ext/mysqli mysqli_api.c

2006-03-26 Thread Andrey Hristov
andrey  Sun Mar 26 21:10:13 2006 UTC

  Modified files:  (Branch: PHP_5_1)
/php-src/ext/mysqli mysqli_api.c 
  Log:
  kill the left unused variable
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.20r2=1.118.2.21diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.20 
php-src/ext/mysqli/mysqli_api.c:1.118.2.21
--- php-src/ext/mysqli/mysqli_api.c:1.118.2.20  Sun Mar 26 21:08:41 2006
+++ php-src/ext/mysqli/mysqli_api.c Sun Mar 26 21:10:13 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_api.c,v 1.118.2.20 2006/03/26 21:08:41 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.118.2.21 2006/03/26 21:10:13 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -632,7 +632,6 @@
unsigned inti;
ulong   ret;
unsigned intuval;
-   double  dval;
my_ulonglongllval;

 

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



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

2006-03-26 Thread Andrei Zmievski
andrei  Sun Mar 26 21:23:00 2006 UTC

  Modified files:  
/php-src/ext/unicodeunicode.c 
  Log:
  Add unicode_get_error_mode() and unicode_get_subst_char().
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/unicode.c?r1=1.16r2=1.17diff_format=u
Index: php-src/ext/unicode/unicode.c
diff -u php-src/ext/unicode/unicode.c:1.16 php-src/ext/unicode/unicode.c:1.17
--- php-src/ext/unicode/unicode.c:1.16  Sun Mar 26 11:06:24 2006
+++ php-src/ext/unicode/unicode.c   Sun Mar 26 21:22:59 2006
@@ -15,7 +15,7 @@
   +--+
 */
 
-/* $Id: unicode.c,v 1.16 2006/03/26 11:06:24 derick Exp $ */ 
+/* $Id: unicode.c,v 1.17 2006/03/26 21:22:59 andrei Exp $ */ 
 
 #include php_unicode.h
 #if HAVE_UNICODE
@@ -174,6 +174,43 @@
zend_update_converters_error_behavior(TSRMLS_C);
RETURN_TRUE;
 }
+/* }}} */
+
+/* {{{ proto int unicode_get_error_mode(int direction) U
+   Returns global conversion error mode for the specified conversion direction 
*/
+PHP_FUNCTION(unicode_get_error_mode)
+{
+   zend_conv_direction direction;
+   long tmp;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, tmp) == 
FAILURE) {
+   return;
+   }
+   direction = (zend_conv_direction) tmp;
+
+   if (direction == ZEND_FROM_UNICODE) {
+   RETURN_LONG(UG(from_error_mode));
+   } else if (direction == ZEND_TO_UNICODE) {
+   RETURN_LONG(UG(to_error_mode));
+   } else {
+   php_error(E_WARNING, Invalid conversion direction value);
+   RETURN_FALSE;
+   }
+}
+/* }}} */
+
+/* {{{ proto string unicode_get_subst_char() U
+   Returns global substitution character for conversion from Unicode to 
codepage */
+PHP_FUNCTION(unicode_get_subst_char)
+{
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ) == FAILURE) {
+   return;
+   }
+
+   RETURN_UNICODE(UG(from_subst_char), 1);
+}
+/* }}} */
+
 
 /* {{{ unicode_functions[] */
 zend_function_entry unicode_functions[] = {
@@ -184,6 +221,8 @@
PHP_FE(unicode_encode, NULL)
PHP_FE(unicode_set_error_mode, NULL)
PHP_FE(unicode_set_subst_char, NULL)
+   PHP_FE(unicode_get_error_mode, NULL)
+   PHP_FE(unicode_get_subst_char, NULL)
PHP_FE(collator_create, NULL)
PHP_FE(collator_compare, NULL)
{ NULL, NULL, NULL }

-- 
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 array.c php_array.h /ext/unicode collator.c config.m4 config.w32 php_unicode.h unicode.c

2006-03-26 Thread Andrei Zmievski

Shouldn't it be called unicode_collator.c?

-Andrei


On Mar 26, 2006, at 3:06 AM, Derick Rethans wrote:


derick  Sun Mar 26 11:06:24 2006 UTC

  Added files:
/php-src/ext/unicodecollator.c

  Modified files:
/php-src/ext/standard   array.c php_array.h
/php-src/ext/unicodeconfig.m4 config.w32 php_unicode.h unicode.c
  Log:
  - Implemented basic collation support. For some reason new  
Collator gives segfaults when the object's collation resource is  
used.

  - The following example shows what is implemented:

  ?php
  $orig = $strings = array(
  'côte',
  'cote',
  'côté',
  'coté',
  'fluße',
  'flüße',
  );

  echo German phonebook:\n;
  $c = collator_create( [EMAIL PROTECTED] );
  foreach($c-sort($strings) as $string) {
  echo $string, \n;
  }
  echo $c-getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
  ? With : Without,  french accent sorting order\n;

  echo \nFrench with options:\n;
  $c = collator_create( fr );
  $c-setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
  $c-setAttribute(Collator::CASE_LEVEL, Collator::ON);
  $c-setStrength(Collator::SECONDARY);
  foreach($c-sort($strings) as $string) {
  echo $string, \n;
  }
  echo $c-getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
  ? With : Without,  french accent sorting order\n;
  ?

derick-20060326110624.txt
--
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



[PHP-CVS] cvs: php-src / unicode-todo.txt

2006-03-26 Thread Andrei Zmievski
andrei  Sun Mar 26 21:46:01 2006 UTC

  Modified files:  
/php-srcunicode-todo.txt 
  Log:
  
  
http://cvs.php.net/viewcvs.cgi/php-src/unicode-todo.txt?r1=1.8r2=1.9diff_format=u
Index: php-src/unicode-todo.txt
diff -u php-src/unicode-todo.txt:1.8 php-src/unicode-todo.txt:1.9
--- php-src/unicode-todo.txt:1.8Sun Mar 26 00:56:23 2006
+++ php-src/unicode-todo.txtSun Mar 26 21:46:01 2006
@@ -61,3 +61,5 @@
 * What to do with binary string literals and runtime casting? Literals are in
   script_encoding, casting uses runtime_encoding. If they are different, bad
   stuff happens.
+
+* Control of fallback mappings in conversions.

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



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

2006-03-26 Thread Yasuo Ohgaki
yohgaki Mon Mar 27 02:59:42 2006 UTC

  Modified files:  
/php-src/ext/pgsql  pgsql.c 
  Log:
  remove pg_execute() E_WARNING error when query plan is not defined
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/pgsql/pgsql.c?r1=1.346r2=1.347diff_format=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.346 php-src/ext/pgsql/pgsql.c:1.347
--- php-src/ext/pgsql/pgsql.c:1.346 Wed Mar 22 17:32:21 2006
+++ php-src/ext/pgsql/pgsql.c   Mon Mar 27 02:59:41 2006
@@ -20,7 +20,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.346 2006/03/22 17:32:21 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.347 2006/03/27 02:59:41 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -1521,7 +1521,6 @@
case PGRES_BAD_RESPONSE:
case PGRES_NONFATAL_ERROR:
case PGRES_FATAL_ERROR:
-   PHP_PQ_ERROR(Query failed: %s, pgsql);
PQclear(pgsql_result);
RETURN_FALSE;
break;

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



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

2006-03-26 Thread Andrei Zmievski
andrei  Mon Mar 27 03:19:30 2006 UTC

  Modified files:  
/php-src/ext/unicodeunicode.c 
  Log:
  Rewrite unicode_encode() and unicode_decode() functions. Apply the new
  conversion error semantics.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/unicode/unicode.c?r1=1.17r2=1.18diff_format=u
Index: php-src/ext/unicode/unicode.c
diff -u php-src/ext/unicode/unicode.c:1.17 php-src/ext/unicode/unicode.c:1.18
--- php-src/ext/unicode/unicode.c:1.17  Sun Mar 26 21:22:59 2006
+++ php-src/ext/unicode/unicode.c   Mon Mar 27 03:19:30 2006
@@ -15,7 +15,7 @@
   +--+
 */
 
-/* $Id: unicode.c,v 1.17 2006/03/26 21:22:59 andrei Exp $ */ 
+/* $Id: unicode.c,v 1.18 2006/03/27 03:19:30 andrei Exp $ */ 
 
 #include php_unicode.h
 #if HAVE_UNICODE
@@ -23,92 +23,112 @@
 
 void php_register_unicode_iterators(TSRMLS_D);
 
-/* {{{ proto unicode unicode_decode(string input, string encoding) U
-   Takes a string in the source encoding and converts it to a UTF-16 unicode 
string, returning the result */
+/* {{{ proto unicode unicode_decode(binary input, string encoding [, int 
flags]) U
+   Takes a binary string converts it to a Unicode string using the specifed 
encoding */
 static PHP_FUNCTION(unicode_decode)
 {
-   union {
-   void *vptr;
-   char *bin;
-   } input;
-   zend_uchar type;
-   int len;
-   char *encoding;
-   int enclen;
+   char *str, *enc;
+   int str_len, enc_len;
+   long flags;
+   UChar *dest;
+   int dest_len;
UErrorCode status;
UConverter *conv = NULL;
-   UChar *target;
-   int targetlen;
+   int num_conv;
 
-   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ts, 
input.vptr, len, type, encoding, enclen)) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Ss|l, str, 
str_len, enc, enc_len, flags)) {
return;
}
 
-   if (type == IS_UNICODE) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, input string is 
already unicode);
-   RETURN_FALSE;
+   if (ZEND_NUM_ARGS()  2) {
+   if ((flags  0xff)  ZEND_CONV_ERROR_LAST_ENUM) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, illegal 
value for conversion error mode);
+   RETURN_FALSE;
+   }
+   } else {
+   flags = UG(to_error_mode);
}
 
status = U_ZERO_ERROR;
-   conv = ucnv_open(encoding, status);
-   if (!conv) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, could not locate 
converter for %s, encoding);
+   conv = ucnv_open(enc, status);
+   if (U_FAILURE(status)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, could not create 
converter for '%s' encoding, enc);
RETURN_FALSE;
}
 
+   zend_set_converter_error_mode(conv, ZEND_TO_UNICODE, flags);
+
status = U_ZERO_ERROR;
-   zend_convert_to_unicode(conv, target, targetlen, input.bin, len, 
status);
+   num_conv = zend_convert_to_unicode(conv, dest, dest_len, str, 
str_len, status);
if (U_FAILURE(status)) {
-   /* TODO: error handling semantics ? */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, conversion was not 
entirely successful: %d, status);
+   zend_raise_conversion_error_ex(could not decode binary 
string, conv, ZEND_TO_UNICODE, num_conv, (flags  ZEND_CONV_ERROR_EXCEPTION) 
TSRMLS_CC);
+   efree(dest);
+   ucnv_close(conv);   
+   RETURN_FALSE;
}
-   RETVAL_UNICODEL(target, targetlen, 0);
-
ucnv_close(conv);   
-}
-/* }}} */
 
-/* {{{ proto bool unicode_semantics() U
-   Check whether unicode semantics are enabled */
-static PHP_FUNCTION(unicode_semantics)
-{
-   RETURN_BOOL(UG(unicode));
+   RETVAL_UNICODEL(dest, dest_len, 0);
 }
 /* }}} */
 
-/* {{{ proto string unicode_encode(unicode input, string encoding) U
-   Takes a unicode string and converts it to a string in the specified 
encoding */
+/* {{{ proto binary unicode_encode(unicode input, string encoding [, int 
flags]) U
+   Takes a Unicode string and converts it to a binary string using the 
specified encoding */
 static PHP_FUNCTION(unicode_encode)
 {
UChar *uni;
-   int len;
-   char *encoding;
-   int enclen;
+   char *enc;
+   int uni_len, enc_len;
+   long flags;
+   char *dest;
+   int dest_len;
UErrorCode status;
UConverter *conv = NULL;
-   char *target;
-   int targetlen;
+   int num_conv;
 
-   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, us, 
uni, len, encoding, enclen)) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Us|l, uni, 
uni_len, enc, enc_len, flags) == FAILURE) {
return;
}
 
+   if (ZEND_NUM_ARGS()  2) {
+

[PHP-CVS] cvs: php-src(PHP_5_1) / acinclude.m4

2006-03-26 Thread Andrei Zmievski
andrei  Mon Mar 27 04:59:36 2006 UTC

  Modified files:  (Branch: PHP_5_1)
/php-srcacinclude.m4 
  Log:
  On Mac OSX, our extensions are actually bundles and should not have
  .dylib extension. Read this:
  
  http://www.sm.luth.se/~alapaa/file_fetch/unixcdbookshelf/mac/ch05_03.htm
  
  
http://cvs.php.net/viewcvs.cgi/php-src/acinclude.m4?r1=1.332.2.10r2=1.332.2.11diff_format=u
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.332.2.10 php-src/acinclude.m4:1.332.2.11
--- php-src/acinclude.m4:1.332.2.10 Tue Feb 28 12:26:03 2006
+++ php-src/acinclude.m4Mon Mar 27 04:59:36 2006
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: acinclude.m4,v 1.332.2.10 2006/02/28 12:26:03 helly Exp $
+dnl $Id: acinclude.m4,v 1.332.2.11 2006/03/27 04:59:36 andrei Exp $
 dnl
 dnl This file contains local autoconf functions.
 dnl
@@ -1890,9 +1890,6 @@
   *hpux*[)]
 SHLIB_SUFFIX_NAME=sl
 ;;
-  *darwin*[)]
-SHLIB_SUFFIX_NAME=dylib
-;;
   esac
 ])
 

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



[PHP-CVS] cvs: php-src(PHP_4_3) / acinclude.m4

2006-03-26 Thread Andrei Zmievski
andrei  Mon Mar 27 05:00:49 2006 UTC

  Modified files:  (Branch: PHP_4_3)
/php-srcacinclude.m4 
  Log:
  MFB
  
  
http://cvs.php.net/viewcvs.cgi/php-src/acinclude.m4?r1=1.218.2.50r2=1.218.2.51diff_format=u
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.218.2.50 php-src/acinclude.m4:1.218.2.51
--- php-src/acinclude.m4:1.218.2.50 Sat Apr 30 09:31:09 2005
+++ php-src/acinclude.m4Mon Mar 27 05:00:49 2006
@@ -1,4 +1,4 @@
-dnl $Id: acinclude.m4,v 1.218.2.50 2005/04/30 09:31:09 sniper Exp $ -*- 
autoconf -*-
+dnl $Id: acinclude.m4,v 1.218.2.51 2006/03/27 05:00:49 andrei Exp $ -*- 
autoconf -*-
 dnl
 dnl This file contains local autoconf functions.
 
@@ -298,9 +298,6 @@
   *hpux*[)]
SHLIB_SUFFIX_NAME=sl
;;
-  *darwin*[)]
-   SHLIB_SUFFIX_NAME=dylib
-   ;;
   esac
 ])
 

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



[PHP-CVS] cvs: php-src / acinclude.m4

2006-03-26 Thread Andrei Zmievski
andrei  Mon Mar 27 05:01:49 2006 UTC

  Modified files:  
/php-srcacinclude.m4 
  Log:
  MFB
  
  
http://cvs.php.net/viewcvs.cgi/php-src/acinclude.m4?r1=1.341r2=1.342diff_format=u
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.341 php-src/acinclude.m4:1.342
--- php-src/acinclude.m4:1.341  Tue Feb 28 13:07:19 2006
+++ php-src/acinclude.m4Mon Mar 27 05:01:48 2006
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: acinclude.m4,v 1.341 2006/02/28 13:07:19 helly Exp $
+dnl $Id: acinclude.m4,v 1.342 2006/03/27 05:01:48 andrei Exp $
 dnl
 dnl This file contains local autoconf functions.
 dnl
@@ -1890,9 +1890,6 @@
   *hpux*[)]
 SHLIB_SUFFIX_NAME=sl
 ;;
-  *darwin*[)]
-SHLIB_SUFFIX_NAME=dylib
-;;
   esac
 ])
 

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



Re: [PHP-CVS] cvs: php-src /ext/unicode unicode.c /main main.c /main/streams filter.c streams.c ZendEngine2 zend.c zend_constants.c zend_globals.h zend_unicode.c zend_unicode.h

2006-03-26 Thread Andi Gutmans

We should namespaces these and all other unicode constants...

+   REGISTER_MAIN_LONG_CONSTANT(FROM_UNICODE, 
ZEND_FROM_UNICODE, CONST_PERSISTENT | CONST_CS);
+   REGISTER_MAIN_LONG_CONSTANT(TO_UNICODE, ZEND_TO_UNICODE, 
CONST_PERSISTENT | CONST_CS);



At 05:48 PM 3/25/2006, Andrei Zmievski wrote:

andrei  Sun Mar 26 01:48:33 2006 UTC

  Modified files:
/ZendEngine2zend.c zend_constants.c zend_globals.h 
zend_unicode.c

zend_unicode.h
/php-src/ext/unicodeunicode.c
/php-src/main   main.c
/php-src/main/streams   filter.c streams.c
  Log:
  * Remove unicode.from_error_mode and unicode.from_subst_char from INI
  settings.
  * Add unicode_set_error_mode() and unicode_set_subst_char() functions to
manipulate these global settings.



--
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



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

2006-03-26 Thread Dmitry Stogov
dmitry  Mon Mar 27 06:02:42 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fixed ZTS build
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/string.c?r1=1.534r2=1.535diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.534 php-src/ext/standard/string.c:1.535
--- php-src/ext/standard/string.c:1.534 Sun Mar 26 02:15:47 2006
+++ php-src/ext/standard/string.c   Mon Mar 27 06:02:42 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.534 2006/03/26 02:15:47 derick Exp $ */
+/* $Id: string.c,v 1.535 2006/03/27 06:02:42 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3513,7 +3513,7 @@
 
 /* {{{ php_u_strtr
  */
-PHPAPI UChar *php_u_strtr(UChar *str, int len, UChar *str_from, int 
str_from_len, UChar *str_to, int str_to_len, int trlen, int *outlen)
+PHPAPI UChar *php_u_strtr(UChar *str, int len, UChar *str_from, int 
str_from_len, UChar *str_to, int str_to_len, int trlen, int *outlen TSRMLS_DC)
 {
int i, j;
int can_optimize = 1;
@@ -3580,7 +3580,7 @@
zend_u_hash_add(tmp_hash, IS_UNICODE, ZSTR(a), 2, tmp, 
sizeof(zval *), NULL);
 
/* Run the replacement */
-   str = php_u_strtr_array(str, len, tmp_hash, minlen, maxlen, 
outlen TSRMLS_DC);
+   str = php_u_strtr_array(str, len, tmp_hash, minlen, maxlen, 
outlen TSRMLS_CC);
zend_hash_destroy(tmp_hash);
efree(tmp_hash);
 
@@ -3589,7 +3589,7 @@
 }
 /* }}} */
 
-static HashTable* php_u_strtr_array_prepare_hashtable(HashTable *hash, int 
*minlen_out, int *maxlen_out)
+static HashTable* php_u_strtr_array_prepare_hashtable(HashTable *hash, int 
*minlen_out, int *maxlen_out TSRMLS_DC)
 {
HashTable *tmp_hash = emalloc(sizeof(HashTable));
HashPosition hpos;
@@ -3851,7 +3851,7 @@
int minlen, maxlen;
HashTable *hash;

-   hash = 
php_u_strtr_array_prepare_hashtable(HASH_OF(*from), minlen, maxlen);
+   hash = 
php_u_strtr_array_prepare_hashtable(HASH_OF(*from), minlen, maxlen TSRMLS_CC);
outstr = php_u_strtr_array(Z_USTRVAL_PP(str), 
Z_USTRLEN_PP(str), hash, minlen, maxlen, outlen TSRMLS_CC);
zend_hash_destroy(hash);
efree(hash);
@@ -3868,7 +3868,7 @@
  Z_USTRVAL_PP(to),
  Z_USTRLEN_PP(to),
  MIN(Z_USTRLEN_PP(from), 
Z_USTRLEN_PP(to)),
- outlen);
+ outlen TSRMLS_CC);
ZVAL_UNICODEL(return_value, outstr, outlen, 0);

Z_TYPE_P(return_value) = IS_UNICODE;

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



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

2006-03-26 Thread Lukas Kahwe Smith

Yasuo Ohgaki wrote:

yohgaki Mon Mar 27 02:59:55 2006 UTC

  Modified files:  (Branch: PHP_5_1)
/php-src/ext/pgsql	pgsql.c 
  Log:

  remove pg_execute() E_WARNING error when query plan is not defined


Sorry but I do not understand the logic behind this change. Nor do I 
think this should go into 5.1.3. I think it makes perfect sense to get 
and E_WARNING for this. Of course there are other ways to check if an 
error did ocurr. Maybe I am misunderstanding the scope of the change, 
but from your comments on internals it just seems you need to beef up 
your customer error handler to ignore supressed errors.


regards,
Lukas

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