[PHP-CVS] cvs: php-src /ext/standard string.c /ext/standard/tests/strings parse_str_basic1.phpt parse_str_basic3.phpt parse_str_basic4.phpt

2009-06-27 Thread Felipe Pena
felipe  Sun Jun 28 02:36:19 2009 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings parse_str_basic1.phpt 
parse_str_basic3.phpt 
parse_str_basic4.phpt 
  Log:
  - Fixed bug #48658 (Change in behaviour of parse_str on php 6.0)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.701r2=1.702diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.701 php-src/ext/standard/string.c:1.702
--- php-src/ext/standard/string.c:1.701 Mon May 25 14:32:15 2009
+++ php-src/ext/standard/string.c   Sun Jun 28 02:36:19 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.701 2009/05/25 14:32:15 felipe Exp $ */
+/* $Id: string.c,v 1.702 2009/06/28 02:36:19 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6199,7 +6199,7 @@
int enc_string_len;
zval *result = NULL;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|a, 
enc_string, enc_string_len, result) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z, 
enc_string, enc_string_len, result) == FAILURE) {
return;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/parse_str_basic1.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/parse_str_basic1.phpt
diff -u php-src/ext/standard/tests/strings/parse_str_basic1.phpt:1.1 
php-src/ext/standard/tests/strings/parse_str_basic1.phpt:1.2
--- php-src/ext/standard/tests/strings/parse_str_basic1.phpt:1.1Tue Jun 
23 22:39:42 2009
+++ php-src/ext/standard/tests/strings/parse_str_basic1.phptSun Jun 28 
02:36:19 2009
@@ -1,8 +1,5 @@
 --TEST--
 Test parse_str() function : basic functionality 
---XFAIL--
-Bug 48658: Test currently fails as parse_str() api insists that the optional 
reult array 
-is pre-defined. 
 --FILE--
 ?php

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/parse_str_basic3.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/parse_str_basic3.phpt
diff -u php-src/ext/standard/tests/strings/parse_str_basic3.phpt:1.1 
php-src/ext/standard/tests/strings/parse_str_basic3.phpt:1.2
--- php-src/ext/standard/tests/strings/parse_str_basic3.phpt:1.1Tue Jun 
23 22:39:42 2009
+++ php-src/ext/standard/tests/strings/parse_str_basic3.phptSun Jun 28 
02:36:19 2009
@@ -1,8 +1,5 @@
 --TEST--
 Test parse_str() function : Basic functionality
---XFAIL--
-Bug 48658: Test currently fails as parse_str() api insists that the optional 
reult array 
-is pre-defined. php.net bugzilla 
 --FILE--
 ?php
 /* Prototype  : void parse_str  ( string $str  [, array $arr  ] )
@@ -163,9 +160,9 @@
 array(1) {
   [uarr]=
   array(2) {
-[first]=
+[ufirst]=
 unicode(3) sid
-[forth]=
+[uforth]=
 unicode(4) bill
   }
 }
@@ -191,19 +188,19 @@
 Test string with single quotes characters
 NULL
 unicode(4) Bill
-unicode(9) O\'Reilly
+unicode(8) O'Reilly
 
 Test string with backslash characters
 NULL
-unicode(7) 10\\2=5
+unicode(6) 10\2=5
 
 Test string with double quotes data
 NULL
-unicode(32) A string with \quoted\ strings
+unicode(30) A string with quoted strings
 
 Test string with nulls
 NULL
-unicode(37) A string with containing \0\0\0 nulls
+unicode(34) A string with containing  
 Test string with 2-dim array with numeric keys
 NULL
@@ -245,7 +242,7 @@
   array(2) {
 [uone]=
 array(1) {
-  [four]=
+  [ufour]=
   unicode(3) sid
 }
 [uthree]=
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/parse_str_basic4.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/parse_str_basic4.phpt
diff -u php-src/ext/standard/tests/strings/parse_str_basic4.phpt:1.1 
php-src/ext/standard/tests/strings/parse_str_basic4.phpt:1.2
--- php-src/ext/standard/tests/strings/parse_str_basic4.phpt:1.1Tue Jun 
23 22:39:42 2009
+++ php-src/ext/standard/tests/strings/parse_str_basic4.phptSun Jun 28 
02:36:19 2009
@@ -1,8 +1,5 @@
 --TEST--
 Test parse_str() function : test with badly formed strings
---XFAIL--
-Bug 48658: Test currently fails as parse_str() api insists that the optional 
reult array 
-is pre-defined. php.net bugzilla 
 --FILE--
 ?php
 /* Prototype  : void parse_str  ( string $str  [, array $arr  ] )



-- 
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 /ext/standard/tests/strings bug21453_binary.phpt bug21744_binary.phpt bug22008_binary.phpt bug23650_binary.phpt bug40432_binary.phpt bug40637_binary.phpt

2009-04-24 Thread Arnaud Le Blanc
lbarnaudFri Apr 24 21:23:48 2009 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug21453_binary.phpt 
bug21744_binary.phpt 
bug22008_binary.phpt 
bug23650_binary.phpt 
bug40432_binary.phpt 
bug40637_binary.phpt 
bug40704_binary.phpt 
bug45485_binary.phpt 
bug46578_binary.phpt 
strip_tags_basic1_binary.phpt 
strip_tags_basic2_binary.phpt 
strip_tags_error_binary.phpt 
strip_tags_binary.phpt 
strip_tags_variation10_binary.phpt 
strip_tags_variation11_binary.phpt 
strip_tags_variation4_binary.phpt 
strip_tags_variation5_binary.phpt 
strip_tags_variation6_binary.phpt 
strip_tags_variation7_binary.phpt 
strip_tags_variation8_binary.phpt 
strip_tags_variation9_binary.phpt 

  Modified files:  
/php-src/ext/standard/tests/strings strip_tags_variation4.phpt 
strip_tags_variation7.phpt 
/php-src/ext/standard   string.c 
  Log:
  strip_tags() fixes:
  - MFH5.3 (Fix bug when  is used within attribute.)
  - Fix handling of case when searching for allowed tags in unicode variant
  - tests for both unicode and binary variants
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strip_tags_variation4.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/strip_tags_variation4.phpt
diff -u php-src/ext/standard/tests/strings/strip_tags_variation4.phpt:1.3 
php-src/ext/standard/tests/strings/strip_tags_variation4.phpt:1.4
--- php-src/ext/standard/tests/strings/strip_tags_variation4.phpt:1.3   Tue May 
27 10:50:46 2008
+++ php-src/ext/standard/tests/strings/strip_tags_variation4.phpt   Fri Apr 
24 21:23:47 2009
@@ -56,9 +56,9 @@
 -- Iteration 4 --
 unicode(0) 
 -- Iteration 5 --
-unicode(5) hello
+unicode(18) htmLhello/htmL
 -- Iteration 6 --
-unicode(5) hello
+unicode(18) htmLhello/htmL
 -- Iteration 7 --
 unicode(9) HtMl text
 -- Iteration 8 --
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strip_tags_variation7.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/strip_tags_variation7.phpt
diff -u php-src/ext/standard/tests/strings/strip_tags_variation7.phpt:1.3 
php-src/ext/standard/tests/strings/strip_tags_variation7.phpt:1.4
--- php-src/ext/standard/tests/strings/strip_tags_variation7.phpt:1.3   Tue May 
27 10:50:46 2008
+++ php-src/ext/standard/tests/strings/strip_tags_variation7.phpt   Fri Apr 
24 21:23:47 2009
@@ -54,9 +54,9 @@
 -- Iteration 4 --
 unicode(0) 
 -- Iteration 5 --
-unicode(5) hello
+unicode(18) htmLhello/htmL
 -- Iteration 6 --
-unicode(5) hello
+unicode(18) htmLhello/htmL
 -- Iteration 7 --
 unicode(9) HtMl text
 -- Iteration 8 --
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.697r2=1.698diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.697 php-src/ext/standard/string.c:1.698
--- php-src/ext/standard/string.c:1.697 Wed Apr  1 17:04:16 2009
+++ php-src/ext/standard/string.c   Fri Apr 24 21:23:47 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.697 2009/04/01 17:04:16 mattwil Exp $ */
+/* $Id: string.c,v 1.698 2009/04/24 21:23:47 lbarnaud Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6253,7 +6253,8 @@
 
while (!done) {
U16_NEXT(tag, idx, len, ch);
-   switch (u_tolower(ch)) {
+   ch = u_tolower(ch);
+   switch (ch) {
case '':
*(n++) = ch;
break;
@@ -6403,6 +6404,9 @@
break;
 
case 0x3C: /* '' */
+   if (in_q) {
+   break;
+   }
U16_GET(buf, 0, idx, len, next);
if (u_isWhitespace(next) == TRUE) {
goto reg_u_char;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug21453_binary.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug21453_binary.phpt
+++ php-src/ext/standard/tests/strings/bug21453_binary.phpt
--TEST--
Bug 

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

2009-04-24 Thread Arnaud Le Blanc
lbarnaudFri Apr 24 21:50:51 2009 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix handling of escaped double quotes
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.698r2=1.699diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.698 php-src/ext/standard/string.c:1.699
--- php-src/ext/standard/string.c:1.698 Fri Apr 24 21:23:47 2009
+++ php-src/ext/standard/string.c   Fri Apr 24 21:50:51 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.698 2009/04/24 21:23:47 lbarnaud Exp $ */
+/* $Id: string.c,v 1.699 2009/04/24 21:50:51 lbarnaud Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6519,7 +6519,7 @@
tp = ((tp-tbuf) = UBYTES(PHP_TAG_BUF_SIZE) ? 
tbuf: tp);
*(tp++) = ch;
}
-   if (state  prev1 != 0x27 /*'\\'*/  (!in_q || ch == 
in_q)) {
+   if (state  prev1 != 0x5C /*'\\'*/  (!in_q || ch == 
in_q)) {
if (in_q) {
in_q = 0;
} else {



-- 
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 /ext/standard/tests/strings bug47546.phpt

2009-03-03 Thread Kalle Sommer Nielsen
kalle   Tue Mar  3 11:46:20 2009 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug47546.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fixed bug #47546 (Default value for limit parameter in explode is 0, not -1)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.692r2=1.693diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.692 php-src/ext/standard/string.c:1.693
--- php-src/ext/standard/string.c:1.692 Sat Feb 14 06:59:36 2009
+++ php-src/ext/standard/string.c   Tue Mar  3 11:46:19 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.692 2009/02/14 06:59:36 moriyoshi Exp $ */
+/* $Id: string.c,v 1.693 2009/03/03 11:46:19 kalle Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1311,7 +1311,7 @@
} else {
add_index_stringl(return_value, 0, (char *)str, 
str_len, 1);
}
-   } else if (limit  0  argc == 3) {
+   } else if (limit  -1  argc == 3) {
if ( str_type == IS_UNICODE ) {
php_u_explode_negative_limit((UChar *)delim, delim_len, 
(UChar *)str, str_len, return_value, limit);
} else {

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug47546.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug47546.phpt
+++ php-src/ext/standard/tests/strings/bug47546.phpt
--TEST--
Bug #47546 (Default value for limit parameter in explode is 0, not -1)
--FILE--
?php
$str = 'one|two|three|four';

print_r(explode('|', $str));
print_r(explode('|', $str, -1));
?
--EXPECT--
Array
(
[0] = one
[1] = two
[2] = three
[3] = four
)
Array
(
[0] = one
[1] = two
[2] = three
[3] = four
)



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

2009-02-13 Thread Moriyoshi Koizumi
moriyoshi   Sat Feb 14 06:59:36 2009 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - These should be E_WARNING for consistency with strpos()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.691r2=1.692diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.691 php-src/ext/standard/string.c:1.692
--- php-src/ext/standard/string.c:1.691 Sat Jan 17 20:36:22 2009
+++ php-src/ext/standard/string.c   Sat Feb 14 06:59:36 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.691 2009/01/17 20:36:22 felipe Exp $ */
+/* $Id: string.c,v 1.692 2009/02/14 06:59:36 moriyoshi Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2784,7 +2784,7 @@
if (offset = 0) {
U16_FWD_N(haystack.u, cu_offset, haystack_len, offset);
if (cu_offset  haystack_len - needle_len) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
u_p = haystack.u + cu_offset;
@@ -2792,13 +2792,13 @@
} else {
u_p = haystack.u;
if (-offset  haystack_len || offset  -INT_MAX) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
} else {
cu_offset = haystack_len;
U16_BACK_N(haystack.u, 0, cu_offset, -offset);
if (cu_offset == 0) {
-   php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Offset is greater than the length of haystack string);
RETURN_FALSE;
}
if (needle_len  haystack_len - cu_offset) {
@@ -2822,14 +2822,14 @@
} else {
if (offset = 0) {
if (offset  haystack_len) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
p = haystack.s + offset;
e = haystack.s + haystack_len - needle_len;
} else {
if (-offset  haystack_len || offset  -INT_MAX) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
 
@@ -2914,7 +2914,7 @@
if (offset = 0) {
U16_FWD_N(haystack.u, cu_offset, haystack_len, offset);
if (cu_offset  haystack_len) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
u_p = haystack.u + cu_offset;
@@ -2922,13 +2922,13 @@
} else {
u_p = haystack.u;
if (-offset  haystack_len || offset  -INT_MAX) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
} else {
cu_offset = haystack_len;
U16_BACK_N(haystack.u, 0, cu_offset, -offset);
if (cu_offset == 0) {
-   php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Offset is greater than the length of haystack string);
+ 

[PHP-CVS] cvs: php-src /ext/standard string.c /ext/standard/tests/file pathinfo_variation2.phpt

2008-12-28 Thread Felipe Pena
felipe  Sun Dec 28 20:16:48 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/filepathinfo_variation2.phpt 
  Log:
  - Unicodify (#46687)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.687r2=1.688diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.687 php-src/ext/standard/string.c:1.688
--- php-src/ext/standard/string.c:1.687 Sat Dec 27 05:13:29 2008
+++ php-src/ext/standard/string.c   Sun Dec 28 20:16:48 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.687 2008/12/27 05:13:29 shire Exp $ */
+/* $Id: string.c,v 1.688 2008/12/28 20:16:48 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2129,7 +2129,7 @@
if (zend_hash_get_current_data(Z_ARRVAL_P(tmp), (void **) 
element) == SUCCESS) {
RETVAL_ZVAL(*element, 1, 0);
} else {
-   ZVAL_EMPTY_STRING(return_value);
+   ZVAL_EMPTY_UNICODE(return_value);
}
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/pathinfo_variation2.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/standard/tests/file/pathinfo_variation2.phpt
diff -u php-src/ext/standard/tests/file/pathinfo_variation2.phpt:1.2 
php-src/ext/standard/tests/file/pathinfo_variation2.phpt:1.3
--- php-src/ext/standard/tests/file/pathinfo_variation2.phpt:1.2Wed Nov 
26 17:48:40 2008
+++ php-src/ext/standard/tests/file/pathinfo_variation2.phptSun Dec 28 
20:16:48 2008
@@ -122,7 +122,7 @@
 unicode(%d) %s
 
 --float .5--
-string(0) 
+unicode(0) 
 
 --empty array--
 Error: 2 - pathinfo() expects parameter 2 to be long, array given, %s(%d)
@@ -141,22 +141,22 @@
 NULL
 
 --uppercase NULL--
-string(0) 
+unicode(0) 
 
 --lowercase null--
-string(0) 
+unicode(0) 
 
 --lowercase true--
 unicode(17) /usr/include/arpa
 
 --lowercase false--
-string(0) 
+unicode(0) 
 
 --uppercase TRUE--
 unicode(17) /usr/include/arpa
 
 --uppercase FALSE--
-string(0) 
+unicode(0) 
 
 --empty string DQ--
 Error: 2 - pathinfo() expects parameter 2 to be long, Unicode string given, 
%s(%d)
@@ -191,9 +191,9 @@
 NULL
 
 --undefined var--
-string(0) 
+unicode(0) 
 
 --unset var--
-string(0) 
+unicode(0) 
 ===DONE===
 



-- 
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 /ext/standard/tests/strings explode.phpt

2008-12-26 Thread Brian Shire
shire   Sat Dec 27 05:13:30 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings explode.phpt 
  Log:
  fix explode behavior to respect negative limit when string is empty.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.686r2=1.687diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.686 php-src/ext/standard/string.c:1.687
--- php-src/ext/standard/string.c:1.686 Mon Nov 24 19:31:02 2008
+++ php-src/ext/standard/string.c   Sat Dec 27 05:13:29 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.686 2008/11/24 19:31:02 lbarnaud Exp $ */
+/* $Id: string.c,v 1.687 2008/12/27 05:13:29 shire Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1294,10 +1294,12 @@
array_init(return_value);
 
if ( str_len == 0 ) {
-   if ( str_type == IS_UNICODE ) {
-   add_next_index_unicodel(return_value, USTR_MAKE(), 
sizeof()-1, 0);
-   } else {
-   add_next_index_stringl(return_value, , sizeof()-1, 
1);
+   if (limit = 0 || argc == 2) {
+   if ( str_type == IS_UNICODE ) {
+   add_next_index_unicodel(return_value, 
USTR_MAKE(), sizeof()-1, 0);
+   } else {
+   add_next_index_stringl(return_value, , 
sizeof()-1, 1);
+   }
}
return;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/explode.phpt?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/standard/tests/strings/explode.phpt
diff -u php-src/ext/standard/tests/strings/explode.phpt:1.9 
php-src/ext/standard/tests/strings/explode.phpt:1.10
--- php-src/ext/standard/tests/strings/explode.phpt:1.9 Tue May 27 10:50:45 2008
+++ php-src/ext/standard/tests/strings/explode.phpt Sat Dec 27 05:13:30 2008
@@ -18,6 +18,7 @@
 var_dump(@explode(NULL, a));
 var_dump(@explode(abc, acb));
 var_dump(@explode(somestring, otherstring));
+var_dump(@explode(somestring, otherstring, -1));
 var_dump(@explode(a, aa));
 var_dump(@explode(==, str_repeat(-=.ord(0).=-, 10)));
 var_dump(@explode(=, str_repeat(-=.ord(0).=-, 10)));
@@ -64,6 +65,8 @@
   [0]=
   unicode(11) otherstring
 }
+array(0) {
+}
 array(7) {
   [0]=
   unicode(0) 



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

2008-11-24 Thread Arnaud Le Blanc
lbarnaudMon Nov 24 19:21:20 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fixed bug #44075 (strtok misbehaving on unicode string)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.684r2=1.685diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.684 php-src/ext/standard/string.c:1.685
--- php-src/ext/standard/string.c:1.684 Fri Nov 21 19:14:46 2008
+++ php-src/ext/standard/string.c   Mon Nov 24 19:21:20 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.684 2008/11/21 19:14:46 felipe Exp $ */
+/* $Id: string.c,v 1.685 2008/11/24 19:21:20 lbarnaud Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1569,8 +1569,11 @@
end = i;
 
if (end - start) {
+   RETVAL_UNICODEL(u_p + start, end - start, 1);
+   /* skip matched token */
+   U16_FWD_1(u_p, end, rem_len);
BG(strtok_last) = u_p + end;
-   RETURN_UNICODEL(u_p + start, end - start, 1);
+   return;
} else {
BG(strtok_last) = NULL;
RETURN_FALSE;



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

2008-11-24 Thread Arnaud Le Blanc
lbarnaudMon Nov 24 19:31:02 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.685r2=1.686diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.685 php-src/ext/standard/string.c:1.686
--- php-src/ext/standard/string.c:1.685 Mon Nov 24 19:21:20 2008
+++ php-src/ext/standard/string.c   Mon Nov 24 19:31:02 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.685 2008/11/24 19:21:20 lbarnaud Exp $ */
+/* $Id: string.c,v 1.686 2008/11/24 19:31:02 lbarnaud Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3986,7 +3986,7 @@
}
if (can_optimize) {
for (i = trlen; i  str_to_len; i++) {
-   if (str_from[i]  255) {
+   if (str_to[i]  255) {
can_optimize = 0;
break;
}



-- 
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 string.c

2008-11-24 Thread Arnaud Le Blanc
On Monday 24 November 2008 20:31:02 Arnaud Le Blanc wrote:
 lbarnaud  Mon Nov 24 19:31:02 2008 UTC
 
   Modified files:  
 /php-src/ext/standard string.c 
   Log:

Log message should have been:
Fix invalid read in strtr().

   
   
 http://cvs.php.net/viewvc.cgi/php-
src/ext/standard/string.c?r1=1.685r2=1.686diff_format=u
 Index: php-src/ext/standard/string.c
 diff -u php-src/ext/standard/string.c:1.685 php-
src/ext/standard/string.c:1.686
 --- php-src/ext/standard/string.c:1.685   Mon Nov 24 19:21:20 2008
 +++ php-src/ext/standard/string.c Mon Nov 24 19:31:02 2008
 @@ -18,7 +18,7 @@
 +--+
   */
  
 -/* $Id: string.c,v 1.685 2008/11/24 19:21:20 lbarnaud Exp $ */
 +/* $Id: string.c,v 1.686 2008/11/24 19:31:02 lbarnaud Exp $ */
  
  /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
  
 @@ -3986,7 +3986,7 @@
   }
   if (can_optimize) {
   for (i = trlen; i  str_to_len; i++) {
 - if (str_from[i]  255) {
 + if (str_to[i]  255) {
   can_optimize = 0;
   break;
   }
 
 
 
 -- 
 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 /ext/standard/tests/strings bug46578.phpt

2008-11-21 Thread Felipe Pena
felipe  Fri Nov 21 19:14:47 2008 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug46578.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - Fixed bug #46578 (strip_tags() does not honor end-of-comment when it 
encounters a single quote)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.683r2=1.684diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.683 php-src/ext/standard/string.c:1.684
--- php-src/ext/standard/string.c:1.683 Tue Oct 21 22:06:48 2008
+++ php-src/ext/standard/string.c   Fri Nov 21 19:14:46 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.683 2008/10/21 22:06:48 lbarnaud Exp $ */
+/* $Id: string.c,v 1.684 2008/11/21 19:14:46 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6538,7 +6538,10 @@
 
case 0x22: /* '' */
case 0x27: /* '\'' */
-   if (state == 2  prev1 != 0x5C) { /* '\\' */
+   if (state == 4){
+   /* Inside !-- comment -- */
+   break;
+   } else if (state == 2  prev1 != 0x5C) { /* '\\' */
if (last == ch) {
last = 0x00;
} else if (last != 0x5C) {
@@ -6779,7 +6782,10 @@
 
case '':
case '\'':
-   if (state == 2  *(p-1) != '\\') {
+   if (state == 4) {
+   /* Inside !-- comment -- */
+   break;
+   } else if (state == 2  *(p-1) != '\\') {
if (lc == c) {
lc = '\0';
} else if (lc != '\\') {

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug46578.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug46578.phpt
+++ php-src/ext/standard/tests/strings/bug46578.phpt
--TEST--
Bug #46578 (strip_tags() does not honor end-of-comment when it encounters a 
single quote)
--FILE--
?php

var_dump(strip_tags('!-- testing I\'ve been to mars --foobar'));

var_dump(strip_tags('a alt=foobarfoo!-- foo! --/abar'));

var_dump(strip_tags('a alt=foobar/foo?= foo! /* !-- cool -- */ 
?bar'));

var_dump(strip_tags(' ax'));

var_dump(strip_tags('! a'));

var_dump(strip_tags('? ax'));

?
--EXPECTF--
%string|unicode%(6) foobar
%string|unicode%(6) foobar
%string|unicode%(6) foobar
%string|unicode%(4)  ax
%string|unicode%(0) 
%string|unicode%(0) 



-- 
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 string.c /ext/standard/tests/strings bug46578.phpt

2008-11-21 Thread Jani Taskinen
You should always mention when closing bug reports that the bug is fixed in only 
some branch, especially this close to a release from branch that the fix was NOT 
included in. (I added the note for you, this is just a reminder :)


--Jani


Felipe Pena kirjoitti:

felipe  Fri Nov 21 19:14:47 2008 UTC

  Added files: 
/php-src/ext/standard/tests/strings	bug46578.phpt 

  Modified files:  
/php-src/ext/standard	string.c 
  Log:

  - Fixed bug #46578 (strip_tags() does not honor end-of-comment when it 
encounters a single quote)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.683r2=1.684diff_format=u

Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.683 php-src/ext/standard/string.c:1.684
--- php-src/ext/standard/string.c:1.683 Tue Oct 21 22:06:48 2008
+++ php-src/ext/standard/string.c   Fri Nov 21 19:14:46 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.683 2008/10/21 22:06:48 lbarnaud Exp $ */

+/* $Id: string.c,v 1.684 2008/11/21 19:14:46 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6538,7 +6538,10 @@
 
 		case 0x22: /* '' */

case 0x27: /* '\'' */
-   if (state == 2  prev1 != 0x5C) { /* '\\' */
+   if (state == 4){
+   /* Inside !-- comment -- */
+   break;
+   } else if (state == 2  prev1 != 0x5C) { /* '\\' */
if (last == ch) {
last = 0x00;
} else if (last != 0x5C) {
@@ -6779,7 +6782,10 @@
 
 			case '':

case '\'':
-   if (state == 2  *(p-1) != '\\') {
+   if (state == 4) {
+   /* Inside !-- comment -- */
+   break;
+   } else if (state == 2  *(p-1) != '\\') {
if (lc == c) {
lc = '\0';
} else if (lc != '\\') {

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug46578.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug46578.phpt
+++ php-src/ext/standard/tests/strings/bug46578.phpt
--TEST--
Bug #46578 (strip_tags() does not honor end-of-comment when it encounters a 
single quote)
--FILE--
?php

var_dump(strip_tags('!-- testing I\'ve been to mars --foobar'));

var_dump(strip_tags('a alt=foobarfoo!-- foo! --/abar'));

var_dump(strip_tags('a alt=foobar/foo?= foo! /* !-- cool -- */ 
?bar'));

var_dump(strip_tags(' ax'));

var_dump(strip_tags('! a'));

var_dump(strip_tags('? ax'));

?
--EXPECTF--
%string|unicode%(6) foobar
%string|unicode%(6) foobar
%string|unicode%(6) foobar
%string|unicode%(4)  ax
%string|unicode%(0) 
%string|unicode%(0) 






--
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 string.c /ext/standard/tests/strings bug46578.phpt

2008-11-21 Thread Felipe Pena
Em Sáb, 2008-11-22 às 00:29 +0200, Jani Taskinen escreveu:
 You should always mention when closing bug reports that the bug is fixed in 
 only 
 some branch, especially this close to a release from branch that the fix was 
 NOT 
 included in. (I added the note for you, this is just a reminder :)
 
 --Jani

My bad, thanks Jani! :D


 Felipe Pena kirjoitti:
  felipe  Fri Nov 21 19:14:47 2008 UTC
  
Added files: 
  /php-src/ext/standard/tests/strings bug46578.phpt 
  
Modified files:  
  /php-src/ext/standard   string.c 
Log:
- Fixed bug #46578 (strip_tags() does not honor end-of-comment when it 
  encounters a single quote)


  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.683r2=1.684diff_format=u
  Index: php-src/ext/standard/string.c
  diff -u php-src/ext/standard/string.c:1.683 
  php-src/ext/standard/string.c:1.684
  --- php-src/ext/standard/string.c:1.683 Tue Oct 21 22:06:48 2008
  +++ php-src/ext/standard/string.c   Fri Nov 21 19:14:46 2008
  @@ -18,7 +18,7 @@
  +--+
*/
   
  -/* $Id: string.c,v 1.683 2008/10/21 22:06:48 lbarnaud Exp $ */
  +/* $Id: string.c,v 1.684 2008/11/21 19:14:46 felipe Exp $ */
   
   /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
   
  @@ -6538,7 +6538,10 @@
   
  case 0x22: /* '' */
  case 0x27: /* '\'' */
  -   if (state == 2  prev1 != 0x5C) { /* '\\' */
  +   if (state == 4){
  +   /* Inside !-- comment -- */
  +   break;
  +   } else if (state == 2  prev1 != 0x5C) { /* '\\' */
  if (last == ch) {
  last = 0x00;
  } else if (last != 0x5C) {
  @@ -6779,7 +6782,10 @@
   
  case '':
  case '\'':
  -   if (state == 2  *(p-1) != '\\') {
  +   if (state == 4) {
  +   /* Inside !-- comment -- */
  +   break;
  +   } else if (state == 2  *(p-1) != '\\') {
  if (lc == c) {
  lc = '\0';
  } else if (lc != '\\') {
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug46578.phpt?view=markuprev=1.1
  Index: php-src/ext/standard/tests/strings/bug46578.phpt
  +++ php-src/ext/standard/tests/strings/bug46578.phpt
  --TEST--
  Bug #46578 (strip_tags() does not honor end-of-comment when it encounters a 
  single quote)
  --FILE--
  ?php
  
  var_dump(strip_tags('!-- testing I\'ve been to mars --foobar'));
  
  var_dump(strip_tags('a alt=foobarfoo!-- foo! --/abar'));
  
  var_dump(strip_tags('a alt=foobar/foo?= foo! /* !-- cool -- */ 
  ?bar'));
  
  var_dump(strip_tags(' ax'));
  
  var_dump(strip_tags('! a'));
  
  var_dump(strip_tags('? ax'));
  
  ?
  --EXPECTF--
  %string|unicode%(6) foobar
  %string|unicode%(6) foobar
  %string|unicode%(6) foobar
  %string|unicode%(4)  ax
  %string|unicode%(0) 
  %string|unicode%(0) 
  
  
  
 
 
-- 
Regards,
Felipe Pena


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

2008-09-14 Thread Arnaud Le Blanc
lbarnaudSun Sep 14 14:56:34 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix str len in stripos when $offset argument is given
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.681r2=1.682diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.681 php-src/ext/standard/string.c:1.682
--- php-src/ext/standard/string.c:1.681 Sat Aug 16 21:16:24 2008
+++ php-src/ext/standard/string.c   Sun Sep 14 14:56:34 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.681 2008/08/16 21:16:24 felipe Exp $ */
+/* $Id: string.c,v 1.682 2008/09/14 14:56:34 lbarnaud Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2664,7 +2664,7 @@
if (Z_TYPE_PP(haystack) == IS_UNICODE) {
/* calculate code unit offset */
U16_FWD_N(Z_USTRVAL_PP(haystack), cu_offset, 
haystack_len, offset);
-   found = php_u_stristr(Z_USTRVAL_PP(haystack) + 
cu_offset, Z_USTRVAL_PP(needle), haystack_len, needle_len, 1 TSRMLS_CC);
+   found = php_u_stristr(Z_USTRVAL_PP(haystack) + 
cu_offset, Z_USTRVAL_PP(needle), haystack_len - cu_offset, needle_len, 1 
TSRMLS_CC);
} else {
haystack_dup = estrndup(Z_STRVAL_PP(haystack), 
haystack_len);
php_strtolower((char *)haystack_dup, haystack_len);
@@ -2686,7 +2686,7 @@
/* calculate code unit offset */
U16_FWD_N(Z_USTRVAL_PP(haystack), cu_offset, 
haystack_len, offset);
found = php_u_stristr(Z_USTRVAL_PP(haystack) + 
cu_offset,
- 
u_needle_char, haystack_len, needle_len, 1 TSRMLS_CC);
+ 
u_needle_char, haystack_len - cu_offset, needle_len, 1 TSRMLS_CC);
} else {
c = tolower((char)Z_LVAL_PP(needle));
needle_char[0] = c;



-- 
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 /ext/standard/tests/strings addslashes_error.phpt addslashes_variation1.phpt strtr_error.phpt strtr_variation5.phpt strtr_variation7.phpt strtr_variation

2008-08-16 Thread Felipe Pena
felipe  Sat Aug 16 21:16:25 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings addslashes_error.phpt 
addslashes_variation1.phpt 
strtr_error.phpt 
strtr_variation5.phpt 
strtr_variation7.phpt 
strtr_variation9.phpt 
  Log:
  - New parameter parsing API
  - Fixed tests
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.680r2=1.681diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.680 php-src/ext/standard/string.c:1.681
--- php-src/ext/standard/string.c:1.680 Thu Aug 14 10:10:56 2008
+++ php-src/ext/standard/string.c   Sat Aug 16 21:16:24 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.680 2008/08/14 10:10:56 tony2001 Exp $ */
+/* $Id: string.c,v 1.681 2008/08/16 21:16:24 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1416,24 +1416,19 @@
Joins array elements placing glue string between items and return one 
string */
 PHP_FUNCTION(implode)
 {
-   zval**arg1 = NULL, **arg2 = NULL;
-   zval*delim, *arr;
-   int argc = ZEND_NUM_ARGS();
-
-   if (argc  1 || argc  2) {
-   WRONG_PARAM_COUNT;
-   }
-   if (zend_get_parameters_ex(argc, arg1, arg2) == FAILURE) {
+   zval **arg1 = NULL, **arg2 = NULL, *delim, *arr;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|Z, arg1, 
arg2) == FAILURE) {
return;
}
 
-   if (argc == 1) {
+   if (ZEND_NUM_ARGS() == 1) {
if (Z_TYPE_PP(arg1) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument 
must be an array);
return;
} else {
SEPARATE_ZVAL(arg1);
-   arr = *arg1;
+   arr = *arg1; 
MAKE_STD_ZVAL(delim);
if (UG(unicode)) {
ZVAL_UNICODEL(delim, EMPTY_STR, sizeof()-1, 
0);
@@ -1464,7 +1459,7 @@
 
php_implode(delim, arr, return_value TSRMLS_CC);
 
-   if (argc == 1) {
+   if (ZEND_NUM_ARGS() == 1) {
FREE_ZVAL(delim);
}
 }
@@ -1509,15 +1504,12 @@
MAKE_STD_ZVAL(zv);
if (str_type == IS_UNICODE) {
ZVAL_UNICODEL(zv, (UChar *)str, str_len, 1);
-   } else {
-   ZVAL_STRINGL(zv, (char *)str, str_len, 1);
-   }
-   BG(strtok_zval) = zv;
-   if (str_type == IS_UNICODE) {
BG(strtok_last) = BG(strtok_string) = 
Z_USTRVAL_P(zv);
} else {
+   ZVAL_STRINGL(zv, (char *)str, str_len, 1);
BG(strtok_last) = BG(strtok_string) = 
Z_STRVAL_P(zv);
}
+   BG(strtok_zval) = zv;
BG(strtok_len) = str_len;
break;
}
@@ -3631,19 +3623,18 @@
Returns the codepoint value of a character */
 PHP_FUNCTION(ord)
 {
-   zval **str;
+   zstr str;
+   int str_len;
+   zend_uchar str_type;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, str) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, str, 
str_len, str_type) == FAILURE) {
+   return;
}
 
-   if (Z_TYPE_PP(str) != IS_UNICODE  Z_TYPE_PP(str) != IS_STRING) {
-   convert_to_text_ex(str);
-   }
-   if (Z_TYPE_PP(str) == IS_UNICODE) {
-   RETURN_LONG(zend_get_codepoint_at(Z_USTRVAL_PP(str), 
Z_USTRLEN_PP(str), 0));
+   if (str_type == IS_UNICODE) {
+   RETURN_LONG(zend_get_codepoint_at(str.u, str_len, 0));
} else {
-   RETURN_LONG((unsigned char) Z_STRVAL_PP(str)[0]);
+   RETURN_LONG((unsigned char) str.s[0]);
}
 }
 /* }}} */
@@ -3652,26 +3643,25 @@
Converts a codepoint number to a character */
 PHP_FUNCTION(chr)
 {
-   zval **num;
+   long num;
char temp[2];
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, num) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, num) == 
FAILURE) {
+   return;
}
-   convert_to_long_ex(num);
 
if (UG(unicode)) {
UChar buf[2];
int buf_len;
 
-   if (Z_LVAL_PP(num)  UCHAR_MAX_VALUE) {
+   if (num  UCHAR_MAX_VALUE) 

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

2008-08-14 Thread Antony Dovgal
tony2001Thu Aug 14 10:10:56 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix folding
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.679r2=1.680diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.679 php-src/ext/standard/string.c:1.680
--- php-src/ext/standard/string.c:1.679 Thu Aug 14 02:55:13 2008
+++ php-src/ext/standard/string.c   Thu Aug 14 10:10:56 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.679 2008/08/14 02:55:13 kalle Exp $ */
+/* $Id: string.c,v 1.680 2008/08/14 10:10:56 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -656,6 +656,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Item '%ld' 
is not valid, item);
RETURN_FALSE;
}
+   /* }}} */
 
value = nl_langinfo(item);
if (value == NULL) {



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

2008-07-29 Thread Felipe Pena
felipe  Tue Jul 29 16:51:22 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - Fix memory leak
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.677r2=1.678diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.677 php-src/ext/standard/string.c:1.678
--- php-src/ext/standard/string.c:1.677 Tue Jul 22 01:05:55 2008
+++ php-src/ext/standard/string.c   Tue Jul 29 16:51:21 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.677 2008/07/22 01:05:55 scottmac Exp $ */
+/* $Id: string.c,v 1.678 2008/07/29 16:51:21 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7842,7 +7842,7 @@
}
str[str_len] = 0;
 
-   RETURN_RT_STRINGL(erealloc(str, str_len + 1), str_len, 0);
+   RETURN_RT_STRINGL(erealloc(str, str_len + 1), str_len, ZSTR_AUTOFREE);
 }
 /* }}} */
 #endif



-- 
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 /ext/standard/tests/strings strrpos_offset.phpt

2008-07-21 Thread Scott MacVicar
scottmacTue Jul 22 01:05:56 2008 UTC

  Added files: 
/php-src/ext/standard/tests/strings strrpos_offset.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix integer oveflow in strrpos()
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.676r2=1.677diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.676 php-src/ext/standard/string.c:1.677
--- php-src/ext/standard/string.c:1.676 Tue Jul 15 14:44:46 2008
+++ php-src/ext/standard/string.c   Tue Jul 22 01:05:55 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.676 2008/07/15 14:44:46 scottmac Exp $ */
+/* $Id: string.c,v 1.677 2008/07/22 01:05:55 scottmac Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2795,7 +2795,7 @@
u_e = haystack.u + haystack_len - needle_len;
} else {
u_p = haystack.u;
-   if (-offset  haystack_len) {
+   if (-offset  haystack_len || offset  -INT_MAX) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
} else {
@@ -2832,7 +2832,7 @@
p = haystack.s + offset;
e = haystack.s + haystack_len - needle_len;
} else {
-   if (-offset  haystack_len) {
+   if (-offset  haystack_len || offset  -INT_MAX) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strrpos_offset.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/strrpos_offset.phpt
+++ php-src/ext/standard/tests/strings/strrpos_offset.phpt
--TEST--
strrpos() offset integer overflow
--FILE--
?php

var_dump(strrpos(t, t, PHP_INT_MAX+1));
var_dump(strrpos(, tt, PHP_INT_MAX+1));
var_dump(strrpos(100, 101, PHP_INT_MAX+1));
var_dump(strrpos(1024, 1024, PHP_INT_MAX+1));
var_dump(strrpos(1024, 1024, -PHP_INT_MAX));
var_dump(strrpos(1024, te, -PHP_INT_MAX));
var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1));
var_dump(strrpos(1024, te, -PHP_INT_MAX-1));

echo Done\n;
?
--EXPECTF--
Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)

Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
bool(false)
Done



-- 
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 /ext/standard/tests/strings strip_tags_variation11.phpt

2008-07-15 Thread Scott MacVicar
scottmacTue Jul 15 14:44:46 2008 UTC

  Added files: 
/php-src/ext/standard/tests/strings strip_tags_variation11.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix bug when  is used within attribute.
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.675r2=1.676diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.675 php-src/ext/standard/string.c:1.676
--- php-src/ext/standard/string.c:1.675 Fri Jul 11 12:43:06 2008
+++ php-src/ext/standard/string.c   Tue Jul 15 14:44:46 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.675 2008/07/11 12:43:06 felipe Exp $ */
+/* $Id: string.c,v 1.676 2008/07/15 14:44:46 scottmac Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6696,6 +6696,9 @@
case '\0':
break;
case '':
+   if (in_q) {
+   break;
+   }
if (isspace(*(p + 1))  !allow_tag_spaces) {
goto reg_char;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strip_tags_variation11.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/strip_tags_variation11.phpt
+++ php-src/ext/standard/tests/strings/strip_tags_variation11.phpt
--TEST--
Test strip_tags() function : obscure values within attributes
--INI--
short_open_tag = on
--FILE--
?php

echo *** Testing strip_tags() : obscure functionality ***\n;

// array of arguments
$string_array = array (
  'hello img title= world',
  'hello img title= world',
  'hello img title=_ world',
  hello img title='_' world
);


// Calling strip_tags() with default arguments
// loop through the $string_array to test strip_tags on various inputs
$iteration = 1;
foreach($string_array as $string)
{
  echo -- Iteration $iteration --\n;
  var_dump( strip_tags($string) );
  $iteration++;
}

echo Done;
?
--EXPECTF--
*** Testing strip_tags() : obscure functionality ***
-- Iteration 1 --
unicode(12) hello  world
-- Iteration 2 --
unicode(12) hello  world
-- Iteration 3 --
unicode(12) hello  world
-- Iteration 4 --
unicode(12) hello  world
Done



-- 
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 /ext/standard/tests/strings bug45485.phpt

2008-07-11 Thread Felipe Pena
felipe  Fri Jul 11 12:43:06 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings bug45485.phpt 
  Log:
  - MFB: Fixed bug #45485 (strip_tags and ?XML tag)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.674r2=1.675diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.674 php-src/ext/standard/string.c:1.675
--- php-src/ext/standard/string.c:1.674 Tue May 27 10:28:25 2008
+++ php-src/ext/standard/string.c   Fri Jul 11 12:43:06 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.674 2008/05/27 10:28:25 mattwil Exp $ */
+/* $Id: string.c,v 1.675 2008/07/11 12:43:06 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6623,12 +6623,13 @@
/* fall-through */
 
case 'l':
+   case 'L':
 
/* swm: If we encounter '?xml' then we shouldn't be in
 * state == 2 (PHP). Switch back to HTML.
 */
 
-   if (state == 2  codepts  2  prev1 == 'm'  prev2 
== 'x') {
+   if (state == 2  codepts  2  (prev1 == 'm' || prev1 
== 'M')  (prev2 == 'x' || prev2 == 'X')) {
state = 1;
break;
}
@@ -6859,12 +6860,13 @@
/* fall-through */
 
case 'l':
+   case 'L':
 
/* swm: If we encounter '?xml' then we 
shouldn't be in
 * state == 2 (PHP). Switch back to HTML.
 */
 
-   if (state == 2  p  buf+2  *(p-1) == 'm'  
*(p-2) == 'x') {
+   if (state == 2  p  buf+2  strncasecmp(p-2, 
xm, 2) == 0) {
state = 1;
break;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug45485.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/bug45485.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/bug45485.phpt:1.2
--- /dev/null   Fri Jul 11 12:43:06 2008
+++ php-src/ext/standard/tests/strings/bug45485.phptFri Jul 11 12:43:06 2008
@@ -0,0 +1,23 @@
+--TEST--
+Bug #45485 (strip_tags and ?XML tag)
+--FILE--
+?php
+
+$s = EOD
+This text is shown ?XML:NAMESPACE PREFIX = ST1 /bThis Text disappears/b
+EOD;
+
+$s = strip_tags($s);
+echo htmlspecialchars($s),\n;
+
+$s = EOD
+This text is shown ?xml:NAMESPACE PREFIX = ST1 /bThis Text disappears/b
+EOD;
+
+$s = strip_tags($s);
+echo htmlspecialchars($s),\n;
+
+?
+--EXPECT--
+This text is shown This Text disappears
+This text is shown This Text disappears



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

2008-05-09 Thread Scott MacVicar
scottmacFri May  9 12:58:50 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix compile error if _GNU_SOURCE is defined
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.672r2=1.673diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.672 php-src/ext/standard/string.c:1.673
--- php-src/ext/standard/string.c:1.672 Tue Apr 29 08:15:49 2008
+++ php-src/ext/standard/string.c   Fri May  9 12:58:50 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.672 2008/04/29 08:15:49 dmitry Exp $ */
+/* $Id: string.c,v 1.673 2008/05/09 12:58:50 scottmac Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -627,14 +627,12 @@
 #endif
 #ifdef DECIMAL_POINT
case DECIMAL_POINT:
-#endif
-#ifdef RADIXCHAR
+#elif defined(RADIXCHAR)
case RADIXCHAR:
 #endif
 #ifdef THOUSANDS_SEP
case THOUSANDS_SEP:
-#endif
-#ifdef THOUSEP
+#elif defined(THOUSEP)
case THOUSEP:
 #endif
 #ifdef GROUPING



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

2008-02-23 Thread Felipe Pena
felipe  Sat Feb 23 18:29:17 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Change some E_STRICTs to E_DEPRECATED
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.669r2=1.670diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.669 php-src/ext/standard/string.c:1.670
--- php-src/ext/standard/string.c:1.669 Sat Feb 23 17:03:53 2008
+++ php-src/ext/standard/string.c   Sat Feb 23 18:29:16 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.669 2008/02/23 17:03:53 helly Exp $ */
+/* $Id: string.c,v 1.670 2008/02/23 18:29:16 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -491,7 +491,7 @@
}
 
if (UG(unicode)) {
-   php_error_docref(NULL TSRMLS_CC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
+   php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, deprecated in 
Unicode mode, please use ICU locale functions);
}
 
switch(item) { /* {{{ */
@@ -6148,7 +6148,7 @@
}
 
if (UG(unicode)) {
-   php_error_docref(NULL TSRMLS_CC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
+   php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, deprecated in 
Unicode mode, please use ICU locale functions);
}
 
 #ifdef HAVE_SETLOCALE
@@ -7177,7 +7177,7 @@
}
 
if (UG(unicode)) {
-   php_error_docref(NULL TSRMLS_CC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
+   php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, deprecated in 
Unicode mode, please use ICU locale functions);
}
 
MAKE_STD_ZVAL(grouping);

-- 
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 /ext/standard/tests/strings substr.phpt substr_compare.phpt

2008-02-13 Thread Etienne Kneuss
colder  Wed Feb 13 16:59:56 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings substr.phpt substr_compare.phpt 
  Log:
  Fix inconcistencies between substr and substr_compare
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.667r2=1.668diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.667 php-src/ext/standard/string.c:1.668
--- php-src/ext/standard/string.c:1.667 Tue Feb 12 01:03:43 2008
+++ php-src/ext/standard/string.c   Wed Feb 13 16:59:56 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.667 2008/02/12 01:03:43 stas Exp $ */
+/* $Id: string.c,v 1.668 2008/02/13 16:59:56 colder Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7985,10 +7985,6 @@
--len;
}
 
-   if (len  0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
The specified segment exceeds string length);
-   RETURN_FALSE;
-   }
} else {
end_offset = s1_len;
}
@@ -8006,14 +8002,13 @@
offset = (offset  0) ? 0 : offset;
}
 
-   if (offset  s1_len) {
+   if (offset = s1_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, The start 
position cannot exceed initial string length);
RETURN_FALSE;
}
 
if (len  s1_len - offset) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The 
specified segment exceeds string length);
-   RETURN_FALSE;
+   len = s1_len - offset;
}
 
cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/substr.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/substr.phpt
diff -u php-src/ext/standard/tests/strings/substr.phpt:1.3 
php-src/ext/standard/tests/strings/substr.phpt:1.4
--- php-src/ext/standard/tests/strings/substr.phpt:1.3  Mon Jul  9 11:38:34 2007
+++ php-src/ext/standard/tests/strings/substr.phpt  Wed Feb 13 16:59:56 2008
@@ -75,6 +75,10 @@
 /* String with international characters */
 echo (\n*** Testing for string with international characters ***\n);
 var_dump (substr('\xIñtërnâtiônàlizætiøn',3) );
+
+/* start 0  -start  length */
+echo \n*** Start before the first char ***\n;
+var_dump (substr(abcd , -8) );
  
 echo\nDone;
 
@@ -218,6 +222,9 @@
 *** Testing for string with international characters ***
 string(26) ñtërnâtiônàlizætiøn
 
+*** Start before the first char ***
+string(4) abcd
+
 Done
 --UEXPECTF--
 *** Testing for error conditions ***
@@ -358,4 +365,7 @@
 *** Testing for string with international characters ***
 unicode(26) ñtërnâtiônàlizætiøn
 
+*** Start before the first char ***
+string(4) abcd
+
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/substr_compare.phpt?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/standard/tests/strings/substr_compare.phpt
diff -u php-src/ext/standard/tests/strings/substr_compare.phpt:1.6 
php-src/ext/standard/tests/strings/substr_compare.phpt:1.7
--- php-src/ext/standard/tests/strings/substr_compare.phpt:1.6  Fri Apr 20 
21:37:31 2007
+++ php-src/ext/standard/tests/strings/substr_compare.phpt  Wed Feb 13 
16:59:56 2008
@@ -9,6 +9,7 @@
 var_dump(substr_compare(abcde, bc, 1, 3));
 var_dump(substr_compare(abcde, cd, 1, 2));
 var_dump(substr_compare(abcde, abc, 5, 1));
+var_dump(substr_compare(abcde, abcdef, -10, 10));
 
 var_dump(substr_compare(abcde, -1, 0, NULL, new stdClass));
 echo Test\n;
@@ -24,8 +25,9 @@
 int(1)
 int(-1)
 
-Warning: substr_compare(): The specified segment exceeds string length in %s 
on line %d
+Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
 bool(false)
+int(0)
 
 Warning: substr_compare() expects parameter 5 to be boolean, object given in 
%s on line %d
 bool(false)
@@ -44,8 +46,9 @@
 int(1)
 int(-1)
 
-Warning: substr_compare(): The specified segment exceeds string length in %s 
on line %d
+Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
 bool(false)
+int(0)
 
 Warning: substr_compare() expects parameter 5 to be boolean, object given in 
%s on line %d
 bool(false)

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

2008-02-11 Thread Stanislav Malyshev
stasTue Feb 12 01:03:43 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFB __DIR__ constant support
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.666r2=1.667diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.666 php-src/ext/standard/string.c:1.667
--- php-src/ext/standard/string.c:1.666 Tue Jan 29 01:44:38 2008
+++ php-src/ext/standard/string.c   Tue Feb 12 01:03:43 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.666 2008/01/29 01:44:38 davidc Exp $ */
+/* $Id: string.c,v 1.667 2008/02/12 01:03:43 stas Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2000,94 +2000,7 @@
Returns directory name component of path */
 PHPAPI int php_u_dirname(UChar *path, int len)
 {
-   register UChar *end = path + len - 1;
-   unsigned int len_adjust = 0;
-
-#ifdef PHP_WIN32
-   /* Note that on Win32 CWD is per drive (heritage from CP/M).
-* This means dirname(c:foo) maps to c:. or c: - which means CWD 
on C: drive.
-*/
-   if ((2 = len)  u_isalpha((UChar32)path[0])  ((UChar)0x3a /*':'*/ 
== path[1])) {
-   /* Skip over the drive spec (if any) so as not to change */
-   path += 2;
-   len_adjust += 2;
-   if (2 == len) {
-   /* Return c: on Win32 for dirname(c:).
-* It would be more consistent to return c:.
-* but that would require making the string *longer*.
-*/
-   return len;
-   }
-   }
-#elif defined(NETWARE)
-   /*
-* Find the first occurence of : from the left
-* move the path pointer to the position just after :
-* increment the len_adjust to the length of path till colon 
character(inclusive)
-* If there is no character beyond : simple return len
-*/
-   UChar *colonpos = NULL;
-   colonpos = u_strchr(path, (UChar) 0x3a /*':'*/);
-   if(colonpos != NULL) {
-   len_adjust = ((colonpos - path) + 1);
-   path += len_adjust;
-   if(len_adjust == len) {
-   return len;
-   }
-   }
-#endif
-
-   if (len == 0) {
-   /* Illegal use of this function */
-   return 0;
-   }
-
-   /* Strip trailing slashes */
-   while (end = path  IS_U_SLASH_P(end)) {
-   end--;
-   }
-   if (end  path) {
-   /* The path only contained slashes */
-   path[0] = DEFAULT_U_SLASH;
-   path[1] = 0;
-   return 1 + len_adjust;
-   }
-
-   /* Strip filename */
-   while (end = path  !IS_U_SLASH_P(end)) {
-   end--;
-   }
-   if (end  path) {
-   /* No slash found, therefore return '.' */
-#ifdef NETWARE
-   if(len_adjust == 0) {
-   path[0] = (UChar) 0x2e /*'.'*/;
-   path[1] = 0;
-   return 1; //only one character
-   }
-   else {
-   path[0] = 0;
-   return len_adjust;
-   }
-#else
-   path[0] = (UChar) 0x2e /*'.'*/;
-   path[1] = 0;
-   return 1 + len_adjust;
-#endif
-   }
-
-   /* Strip slashes which came before the file name */
-   while (end = path  IS_U_SLASH_P(end)) {
-   end--;
-   }
-   if (end  path) {
-   path[0] = DEFAULT_U_SLASH;
-   path[1] = 0;
-   return 1 + len_adjust;
-   }
-   *(end+1) = 0;
-
-   return (size_t)(end + 1 - path) + len_adjust;
+   return zend_u_dirname(path, len);
 }
 /* }}} */
 
@@ -2095,94 +2008,7 @@
Returns directory name component of path */
 PHPAPI int php_dirname(char *path, int len)
 {
-   register char *end = path + len - 1;
-   unsigned int len_adjust = 0;
-
-#ifdef PHP_WIN32
-   /* Note that on Win32 CWD is per drive (heritage from CP/M).
-* This means dirname(c:foo) maps to c:. or c: - which means CWD 
on C: drive.
-*/
-   if ((2 = len)  isalpha((int)((unsigned char *)path)[0])  (':' == 
path[1])) {
-   /* Skip over the drive spec (if any) so as not to change */
-   path += 2;
-   len_adjust += 2;
-   if (2 == len) {
-   /* Return c: on Win32 for dirname(c:).
-* It would be more consistent to return c:.
-* but that would require making the string *longer*.
-*/
-   return len;
-   }
-   }
-#elif defined(NETWARE)
-   /*
-* Find the first occurence of : from the left
-* move the path pointer to the position just 

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

2008-01-28 Thread David Coallier
davidc  Tue Jan 29 01:44:38 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - Good proto message and description of function
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.665r2=1.666diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.665 php-src/ext/standard/string.c:1.666
--- php-src/ext/standard/string.c:1.665 Mon Jan 21 14:37:19 2008
+++ php-src/ext/standard/string.c   Tue Jan 29 01:44:38 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.665 2008/01/21 14:37:19 tony2001 Exp $ */
+/* $Id: string.c,v 1.666 2008/01/29 01:44:38 davidc Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3889,8 +3889,8 @@
 }
 /* }}} */
 
-/* {{{ proto string ucfirst(string str) U
-   Makes a string's first character uppercase */
+/* {{{ proto string lcfirst(string str) U
+   Makes a string's first character lowercase */
 PHP_FUNCTION(lcfirst)
 {
zstr   str;

-- 
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 /ext/standard/tests/strings bug42861.phpt

2008-01-21 Thread Antony Dovgal
tony2001Mon Jan 21 14:37:19 2008 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug42861.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #42861 (strtr() crashes in Unicode mode when $from argument is empty) 
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.664r2=1.665diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.664 php-src/ext/standard/string.c:1.665
--- php-src/ext/standard/string.c:1.664 Sat Jan 19 19:47:41 2008
+++ php-src/ext/standard/string.c   Mon Jan 21 14:37:19 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.664 2008/01/19 19:47:41 davidc Exp $ */
+/* $Id: string.c,v 1.665 2008/01/21 14:37:19 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4151,6 +4151,7 @@
int can_optimize = 1;
 
if ((trlen  1) || (len  1)) {
+   *outlen = len;
return str;
}
 
@@ -4270,6 +4271,7 @@
len = string_key_len-1;
if (len  1) {
zend_hash_destroy(tmp_hash);
+   efree(tmp_hash);
return NULL;
}
zend_u_hash_add(tmp_hash, IS_UNICODE, 
string_key, string_key_len, entry, sizeof(zval*), NULL);
@@ -4506,19 +4508,23 @@
}
 
if (Z_TYPE_PP(str) == IS_UNICODE) {
-   int outlen;
+   int outlen = 0;
UChar *outstr;
 
if (ac == 2) {
-   int minlen, maxlen;
+   int minlen = 0, maxlen = 0;
HashTable *hash;
 
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);
-   RETVAL_UNICODEL(outstr, outlen, 0);
-   Z_TYPE_P(return_value) = IS_UNICODE;
+   if (hash) {
+   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);
+   RETVAL_UNICODEL(outstr, outlen, 0);
+   Z_TYPE_P(return_value) = IS_UNICODE;
+   } else {
+   RETURN_ZVAL(*str, 1, 0);
+   }
} else {
convert_to_unicode_ex(from);
convert_to_unicode_ex(to);
@@ -4531,7 +4537,12 @@
  Z_USTRLEN_PP(to),
  MIN(Z_USTRLEN_PP(from), 
Z_USTRLEN_PP(to)),
  outlen TSRMLS_CC);
-   ZVAL_UNICODEL(return_value, outstr, outlen, 0);
+
+   if (Z_USTRVAL_PP(str) == outstr) {
+   ZVAL_UNICODEL(return_value, outstr, outlen, 1);
+   } else {
+   ZVAL_UNICODEL(return_value, outstr, outlen, 0);
+   }
 
Z_TYPE_P(return_value) = IS_UNICODE;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug42861.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug42861.phpt
+++ php-src/ext/standard/tests/strings/bug42861.phpt
--TEST--
Bug #42861 (strtr() crashes in Unicode mode when $from argument is empty)
--FILE--
?php

var_dump( strtr(hello, array( = string) ) );
var_dump( strtr(hello, array('' = string) ) );
var_dump( strtr(hello, array(null = string) ) );
var_dump( strtr(hello, array(NULL = string) ) );

var_dump( strtr(hello, , string) );
var_dump( strtr(hello, '', string) );
var_dump( strtr(hello, NULL, string) );
var_dump( strtr(hello, null, string) );

echo Done\n;
?
--EXPECTF-- 
bool(false)
bool(false)
bool(false)
bool(false)
string(5) hello
string(5) hello
string(5) hello
string(5) hello
Done
--UEXPECTF--
unicode(5) hello
unicode(5) hello
unicode(5) hello
unicode(5) hello
unicode(5) hello
unicode(5) hello
unicode(5) hello
unicode(5) hello
Done

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

2008-01-16 Thread Antony Dovgal
tony2001Wed Jan 16 08:34:06 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #43863 (str_word_count() breaks on cyrillic ya in locale cp1251)
  patch by phprus at gmail dot com
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.661r2=1.662diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.661 php-src/ext/standard/string.c:1.662
--- php-src/ext/standard/string.c:1.661 Wed Jan 16 03:09:01 2008
+++ php-src/ext/standard/string.c   Wed Jan 16 08:34:06 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.661 2008/01/16 03:09:01 davidc Exp $ */
+/* $Id: string.c,v 1.662 2008/01/16 08:34:06 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7821,7 +7821,7 @@
 
while (p  e) {
s = p;
-   while (p  e  (isalpha(*p) || (char_list  ch[(unsigned 
char)*p]) || *p == '\'' || *p == '-')) {
+   while (p  e  (isalpha((unsigned char)*p) || (char_list  
ch[(unsigned char)*p]) || *p == '\'' || *p == '-')) {
p++;
}
if (p  s) {

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

2008-01-15 Thread David Coallier
davidc  Wed Jan 16 03:09:01 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - Make sure ucfirst is using the new zend-parse-parameters api
  - added php_ucfirst for non-unicode calls
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.660r2=1.661diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.660 php-src/ext/standard/string.c:1.661
--- php-src/ext/standard/string.c:1.660 Thu Jan 10 14:31:11 2008
+++ php-src/ext/standard/string.c   Wed Jan 16 03:09:01 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.660 2008/01/10 14:31:11 tony2001 Exp $ */
+/* $Id: string.c,v 1.661 2008/01/16 03:09:01 davidc Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3858,23 +3858,34 @@
 
 /* {{{ php_u_ucfirst()
Makes an Unicode string's first character uppercase */
-static void php_u_ucfirst(zval *ustr, zval *return_value TSRMLS_DC)
+static void php_u_ucfirst(UChar *ustr, int ustr_len, zval *return_value 
TSRMLS_DC)
 {
UChar tmp[3] = { 0, 0, 0 }; /* UChar32 will be converted to upto 2 
UChar units */
int tmp_len = 0;
int pos = 0;
UErrorCode status = U_ZERO_ERROR;
 
-   U16_FWD_1(Z_USTRVAL_P(ustr), pos, Z_USTRLEN_P(ustr));
-   tmp_len = u_strToUpper(tmp, sizeof(tmp)/sizeof(UChar), 
Z_USTRVAL_P(ustr), pos, UG(default_locale), status);
+   U16_FWD_1(ustr, pos, ustr_len);
+   tmp_len = u_strToUpper(tmp, sizeof(tmp)/sizeof(UChar), ustr, pos, 
UG(default_locale), status);
 
-   Z_USTRVAL_P(return_value) = eumalloc(tmp_len+Z_USTRLEN_P(ustr)-pos+1);
+   Z_USTRVAL_P(return_value) = eumalloc(tmp_len + ustr_len - pos+1);
+   
Z_USTRVAL_P(return_value)[0] = tmp[0];
if (tmp_len  1) {
Z_USTRVAL_P(return_value)[1] = tmp[1];
}
-   u_memcpy(Z_USTRVAL_P(return_value)+tmp_len, Z_USTRVAL_P(ustr)+pos, 
Z_USTRLEN_P(ustr)-pos+1);
-   Z_USTRLEN_P(return_value) = tmp_len+Z_USTRLEN_P(ustr)-pos;
+   u_memcpy(Z_USTRVAL_P(return_value)+tmp_len, ustr + pos, ustr_len - 
pos+1);
+   Z_USTRLEN_P(return_value) = tmp_len + ustr_len - pos;
+}
+/* }}} */
+
+/* {{{ php_ucfirst 
+   Uppercase the first character of the word in a native string */
+static void php_ucfirst(char *str)
+{
+   register char *r;
+   r = str;
+   *r = toupper((unsigned char) *r);
 }
 /* }}} */
 
@@ -3882,29 +3893,29 @@
Makes a string's first character uppercase */
 PHP_FUNCTION(ucfirst)
 {
-   zval **str;
-
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, str) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
-   }
-
-   if (Z_TYPE_PP(str) != IS_UNICODE  Z_TYPE_PP(str) != IS_STRING) {
-   convert_to_text_ex(str);
-   }
+   zstr   str;
+   intstr_len;
+   zend_uchar str_type;
 
-   if (Z_TYPE_PP(str) == IS_UNICODE  !Z_USTRLEN_PP(str)) {
-   RETURN_EMPTY_UNICODE();
-   } else if (!Z_STRLEN_PP(str)) {
-   RETURN_EMPTY_STRING();
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, str, 
str_len, str_type) == FAILURE) {
+   return;
}
+   
+   if (str_len == 0) {
+   if (str_type == IS_UNICODE) {
+   RETURN_EMPTY_UNICODE();
+   } else {
+   RETURN_EMPTY_STRING();
+   }
+   }   
 
-   if (Z_TYPE_PP(str) == IS_UNICODE) {
+   if (str_type == IS_UNICODE) {
Z_TYPE_P(return_value) = IS_UNICODE;
-   php_u_ucfirst(*str, return_value TSRMLS_CC);
+   php_u_ucfirst(str.u, str_len, return_value TSRMLS_CC);
} else {
-   ZVAL_STRINGL(return_value, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 
1);
-   *Z_STRVAL_P(return_value) = toupper((unsigned char) 
*Z_STRVAL_P(return_value));
-   }
+   ZVAL_STRINGL(return_value, str.s, str_len, ZSTR_DUPLICATE);
+   php_ucfirst(Z_STRVAL_P(return_value));
+   }   
 }
 /* }}} */
 

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

2008-01-10 Thread Antony Dovgal
tony2001Thu Jan 10 14:31:11 2008 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #43750 (stristr() modifies string)
  patch by Felipe Pena
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.659r2=1.660diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.659 php-src/ext/standard/string.c:1.660
--- php-src/ext/standard/string.c:1.659 Mon Dec 31 07:12:16 2007
+++ php-src/ext/standard/string.c   Thu Jan 10 14:31:11 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.659 2007/12/31 07:12:16 sebastian Exp $ */
+/* $Id: string.c,v 1.660 2008/01/10 14:31:11 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2526,6 +2526,9 @@
return;
}
 
+   SEPARATE_ZVAL(haystack);
+   SEPARATE_ZVAL(needle);
+
if (Z_TYPE_PP(haystack) != IS_UNICODE  Z_TYPE_PP(haystack) != 
IS_STRING) {
convert_to_text_ex(haystack);
}

-- 
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 /ext/standard/tests/strings chunk_split_error.phpt chunk_split_variation5.phpt chunk_split_variation8.phpt htmlspecialchars_decode_variation2.phpt ZendE

2007-12-24 Thread Dmitry Stogov
dmitry  Mon Dec 24 18:10:20 2007 UTC

  Modified files:  
/ZendEngine2zend_operators.c 
/ZendEngine2/tests  int_overflow_64bit.phpt 
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings chunk_split_error.phpt 
chunk_split_variation5.phpt 
chunk_split_variation8.phpt 
htmlspecialchars_decode_variation2.phpt 
  Log:
  Additional fix for bug #42868
  
  http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.285r2=1.286diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.285 ZendEngine2/zend_operators.c:1.286
--- ZendEngine2/zend_operators.c:1.285  Mon Dec 17 11:06:42 2007
+++ ZendEngine2/zend_operators.cMon Dec 24 18:10:19 2007
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: zend_operators.c,v 1.285 2007/12/17 11:06:42 dmitry Exp $ */
+/* $Id: zend_operators.c,v 1.286 2007/12/24 18:10:19 dmitry Exp $ */
 
 #include ctype.h
 
@@ -243,34 +243,35 @@
 #define MAX_UNSIGNED_INT ((double) LONG_MAX * 2) + 1
 #ifdef _WIN64
 # define DVAL_TO_LVAL(d, l) \
-if ((d)  LONG_MAX) { \
-if ((d)  MAX_UNSIGNED_INT) { \
-(l) = LONG_MAX; \
-} else { \
-(l) = (long)(unsigned long)(__int64) (d); \
-} \
-} else { \
-if((d)  LONG_MIN) { \
-(l) = LONG_MIN; \
-} else { \
-(l) = (long) (d); \
-} \
-}
+   if ((d)  LONG_MAX) { \
+   (l) = (long)(unsigned long)(__int64) (d); \
+   } else { \
+   (l) = (long) (d); \
+   }
+#elif !defined(_WIN64)  __WORDSIZE == 64
+# define DVAL_TO_LVAL(d, l) \
+   if ((d) = LONG_MAX) { \
+   (l) = LONG_MAX; \
+   } else if ((d) =  LONG_MIN) { \
+   (l) = LONG_MIN; \
+   } else {\
+   (l) = (long) (d); \
+   }
 #else
 # define DVAL_TO_LVAL(d, l) \
-if ((d)  LONG_MAX) { \
-if ((d)  MAX_UNSIGNED_INT) { \
-(l) = LONG_MAX; \
-} else { \
-(l) = (unsigned long) (d); \
-} \
-} else { \
-if((d)  LONG_MIN) { \
-(l) = LONG_MIN; \
-} else { \
-(l) = (long) (d); \
-} \
-}
+   if ((d)  LONG_MAX) { \
+   if ((d)  MAX_UNSIGNED_INT) { \
+   (l) = LONG_MAX; \
+   } else { \
+   (l) = (unsigned long) (d); \
+   } \
+   } else { \
+   if((d)  LONG_MIN) { \
+   (l) = LONG_MIN; \
+   } else { \
+   (l) = (long) (d); \
+   } \
+   }
 #endif
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/int_overflow_64bit.phpt?r1=1.2r2=1.3diff_format=u
Index: ZendEngine2/tests/int_overflow_64bit.phpt
diff -u ZendEngine2/tests/int_overflow_64bit.phpt:1.2 
ZendEngine2/tests/int_overflow_64bit.phpt:1.3
--- ZendEngine2/tests/int_overflow_64bit.phpt:1.2   Thu Sep 28 12:08:44 2006
+++ ZendEngine2/tests/int_overflow_64bit.phpt   Mon Dec 24 18:10:19 2007
@@ -6,11 +6,13 @@
 ?php
 
 $doubles = array(
-9223372036854775808,
-9223372036854775809,
-9223372036854775818,
-9223372036854775908,
-9223372036854776808,
+PHP_INT_MAX,
+PHP_INT_MAX + 1,
+PHP_INT_MAX + 1000,
+PHP_INT_MAX * 2 + 4,
+-PHP_INT_MAX -1,
+-PHP_INT_MAX -2,
+-PHP_INT_MAX -1000,
 );
 
 foreach ($doubles as $d) {
@@ -21,8 +23,10 @@
 echo Done\n;
 ?
 --EXPECTF--
-int(-9223372036854775808)
-int(-9223372036854775808)
+int(9223372036854775807)
+int(9223372036854775807)
+int(9223372036854775807)
+int(9223372036854775807)
 int(-9223372036854775808)
 int(-9223372036854775808)
 int(-9223372036854775808)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.657r2=1.658diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.657 php-src/ext/standard/string.c:1.658
--- php-src/ext/standard/string.c:1.657 Thu Dec 13 22:29:15 2007
+++ php-src/ext/standard/string.c   Mon Dec 24 18:10:19 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.657 2007/12/13 22:29:15 tony2001 Exp $ */
+/* $Id: string.c,v 1.658 2007/12/24 18:10:19 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3339,7 +3339,7 @@
zstr result;
char *end= \r\n;
UChar u_end[3] = { 0x0d, 0x0a, 0x0 };
-   int chunklen = 76;
+   long chunklen = 76;
int result_len;

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

2007-12-13 Thread Antony Dovgal
tony2001Thu Dec 13 22:29:15 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  add workaround for glibc issue
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.656r2=1.657diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.656 php-src/ext/standard/string.c:1.657
--- php-src/ext/standard/string.c:1.656 Wed Nov 21 02:27:07 2007
+++ php-src/ext/standard/string.c   Thu Dec 13 22:29:15 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.656 2007/11/21 02:27:07 stas Exp $ */
+/* $Id: string.c,v 1.657 2007/12/13 22:29:15 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -494,6 +494,173 @@
php_error_docref(NULL TSRMLS_CC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
}
 
+   switch(item) { /* {{{ */
+#ifdef ABDAY_1
+   case ABDAY_1:
+   case ABDAY_2:
+   case ABDAY_3:
+   case ABDAY_4:
+   case ABDAY_5:
+   case ABDAY_6:
+   case ABDAY_7:
+#endif
+#ifdef DAY_1
+   case DAY_1:
+   case DAY_2:
+   case DAY_3:
+   case DAY_4:
+   case DAY_5:
+   case DAY_6:
+   case DAY_7:
+#endif
+#ifdef ABMON_1
+   case ABMON_1:
+   case ABMON_2:
+   case ABMON_3:
+   case ABMON_4:
+   case ABMON_5:
+   case ABMON_6:
+   case ABMON_7:
+   case ABMON_8:
+   case ABMON_9:
+   case ABMON_10:
+   case ABMON_11:
+   case ABMON_12:
+#endif
+#ifdef MON_1
+   case MON_1:
+   case MON_2:
+   case MON_3:
+   case MON_4:
+   case MON_5:
+   case MON_6:
+   case MON_7:
+   case MON_8:
+   case MON_9:
+   case MON_10:
+   case MON_11:
+   case MON_12:
+#endif
+#ifdef AM_STR
+   case AM_STR:
+#endif
+#ifdef PM_STR
+   case PM_STR:
+#endif
+#ifdef D_T_FMT
+   case D_T_FMT:
+#endif
+#ifdef D_FMT
+   case D_FMT:
+#endif
+#ifdef T_FMT
+   case T_FMT:
+#endif
+#ifdef T_FMT_AMPM
+   case T_FMT_AMPM:
+#endif
+#ifdef ERA
+   case ERA:
+#endif
+#ifdef ERA_YEAR
+   case ERA_YEAR:
+#endif
+#ifdef ERA_D_T_FMT
+   case ERA_D_T_FMT:
+#endif
+#ifdef ERA_D_FMT
+   case ERA_D_FMT:
+#endif
+#ifdef ERA_T_FMT
+   case ERA_T_FMT:
+#endif
+#ifdef ALT_DIGITS
+   case ALT_DIGITS:
+#endif
+#ifdef INT_CURR_SYMBOL
+   case INT_CURR_SYMBOL:
+#endif
+#ifdef CURRENCY_SYMBOL
+   case CURRENCY_SYMBOL:
+#endif
+#ifdef CRNCYSTR
+   case CRNCYSTR:
+#endif
+#ifdef MON_DECIMAL_POINT
+   case MON_DECIMAL_POINT:
+#endif
+#ifdef MON_THOUSANDS_SEP
+   case MON_THOUSANDS_SEP:
+#endif
+#ifdef MON_GROUPING
+   case MON_GROUPING:
+#endif
+#ifdef POSITIVE_SIGN
+   case POSITIVE_SIGN:
+#endif
+#ifdef NEGATIVE_SIGN
+   case NEGATIVE_SIGN:
+#endif
+#ifdef INT_FRAC_DIGITS
+   case INT_FRAC_DIGITS:
+#endif
+#ifdef FRAC_DIGITS
+   case FRAC_DIGITS:
+#endif
+#ifdef P_CS_PRECEDES
+   case P_CS_PRECEDES:
+#endif
+#ifdef P_SEP_BY_SPACE
+   case P_SEP_BY_SPACE:
+#endif
+#ifdef N_CS_PRECEDES
+   case N_CS_PRECEDES:
+#endif
+#ifdef N_SEP_BY_SPACE
+   case N_SEP_BY_SPACE:
+#endif
+#ifdef P_SIGN_POSN
+   case P_SIGN_POSN:
+#endif
+#ifdef N_SIGN_POSN
+   case N_SIGN_POSN:
+#endif
+#ifdef DECIMAL_POINT
+   case DECIMAL_POINT:
+#endif
+#ifdef RADIXCHAR
+   case RADIXCHAR:
+#endif
+#ifdef THOUSANDS_SEP
+   case THOUSANDS_SEP:
+#endif
+#ifdef THOUSEP
+   case THOUSEP:
+#endif
+#ifdef GROUPING
+   case GROUPING:
+#endif
+#ifdef YESEXPR
+   case YESEXPR:
+#endif
+#ifdef NOEXPR
+   case NOEXPR:
+#endif
+#ifdef YESSTR
+   case YESSTR:
+#endif
+#ifdef NOSTR
+   case NOSTR:
+#endif
+#ifdef CODESET
+   case CODESET:
+#endif
+   break;
+   default:
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Item '%ld' 
is not valid, item);
+   RETURN_FALSE;
+   }
+
value = nl_langinfo(item);
if (value == NULL) {
RETURN_FALSE;

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

2007-11-20 Thread Stanislav Malyshev
stasWed Nov 21 02:27:07 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #42866, from Claudio Cherubino
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.655r2=1.656diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.655 php-src/ext/standard/string.c:1.656
--- php-src/ext/standard/string.c:1.655 Sun Oct  7 05:15:06 2007
+++ php-src/ext/standard/string.c   Wed Nov 21 02:27:07 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.655 2007/10/07 05:15:06 davidw Exp $ */
+/* $Id: string.c,v 1.656 2007/11/21 02:27:07 stas Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7802,7 +7802,7 @@
}
 
if (p != (str.s + str_len * charsize)) {
-   add_next_index_zstrl(return_value, str_type, ZSTR(p), (str.s + 
str_len * charsize - p), 1);
+   add_next_index_zstrl(return_value, str_type, ZSTR(p), (str.s + 
str_len * charsize - p)/charsize, 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 string.c

2007-10-02 Thread Antony Dovgal
tony2001Tue Oct  2 11:35:26 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  make strcspn() behave the same way in both Unicode and native mode (bug 
#42731)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.653r2=1.654diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.653 php-src/ext/standard/string.c:1.654
--- php-src/ext/standard/string.c:1.653 Mon Oct  1 13:41:57 2007
+++ php-src/ext/standard/string.c   Tue Oct  2 11:35:26 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.653 2007/10/01 13:41:57 jani Exp $ */
+/* $Id: string.c,v 1.654 2007/10/02 11:35:26 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2306,7 +2306,11 @@
 
for (i = 0, codepts = 0 ; i  len1 ; ) {
U16_NEXT(s1, i, len1, ch);
-   if (!len2 || u_memchr32(s2, ch, len2)) {
+   if (len2) {
+   if (u_memchr32(s2, ch, len2)) {
+   break;
+   }
+   } else if (ch == (UChar32)0x00){
break;
}
codepts++;

-- 
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 /ext/standard/tests/strings implode1.phpt join_error.phpt join_variation2.phpt

2007-10-01 Thread Jani Taskinen
janiMon Oct  1 12:04:09 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings implode1.phpt join_error.phpt 
join_variation2.phpt 
  Log:
  - Fixed bug #42789 (join() warning messages are not proper  different
return value on php5/6)
  # For consistency between 5/6 also made the return value be NULL like it
  # has been for ages when invalid stuff is passed.
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.651r2=1.652diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.651 php-src/ext/standard/string.c:1.652
--- php-src/ext/standard/string.c:1.651 Fri Sep  7 02:28:26 2007
+++ php-src/ext/standard/string.c   Mon Oct  1 12:04:09 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.651 2007/09/07 02:28:26 iliaa Exp $ */
+/* $Id: string.c,v 1.652 2007/10/01 12:04:09 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1265,8 +1265,8 @@
 
if (argc == 1) {
if (Z_TYPE_PP(arg1) != IS_ARRAY) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument 
to implode must be an array);
-   RETURN_FALSE;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument 
must be an array);
+   return;
} else {
SEPARATE_ZVAL(arg1);
arr = *arg1;
@@ -1293,8 +1293,8 @@
}
delim = *arg1;
} else {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Bad 
arguments);
-   RETURN_FALSE;
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
arguments passed);
+   return;
}
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/implode1.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/implode1.phpt
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_error.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/join_error.phpt
diff -u php-src/ext/standard/tests/strings/join_error.phpt:1.1 
php-src/ext/standard/tests/strings/join_error.phpt:1.2
--- php-src/ext/standard/tests/strings/join_error.phpt:1.1  Sat Sep 29 
09:08:24 2007
+++ php-src/ext/standard/tests/strings/join_error.phpt  Mon Oct  1 12:04:09 2007
@@ -1,5 +1,5 @@
 --TEST--
-Test join() function : error conditions(Bug#42789) 
+Test join() function: error conditions
 --FILE--
 ?php
 /* Prototype  : string join( string $glue, array $pieces )
@@ -45,8 +45,8 @@
 
 -- Testing join() with less than expected no. of arguments --
 
-Warning: join(): Argument to join must be an array in %s on line %d
-bool(false)
+Warning: join(): Argument must be an array in %s on line %d
+NULL
 Done
 --UEXPECTF--
 *** Testing join() : error conditions ***
@@ -63,6 +63,6 @@
 
 -- Testing join() with less than expected no. of arguments --
 
-Warning: join(): Argument to join must be an array in %s on line %d
-bool(false)
+Warning: join(): Argument must be an array in %s on line %d
+NULL
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation2.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/join_variation2.phpt
diff -u php-src/ext/standard/tests/strings/join_variation2.phpt:1.1 
php-src/ext/standard/tests/strings/join_variation2.phpt:1.2
--- php-src/ext/standard/tests/strings/join_variation2.phpt:1.1 Sat Sep 29 
09:08:24 2007
+++ php-src/ext/standard/tests/strings/join_variation2.phpt Mon Oct  1 
12:04:09 2007
@@ -102,95 +102,95 @@
 --- Testing join() by supplying different values for 'pieces' argument ---
 -- Iteration 1 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 2 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 3 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 4 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 5 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 6 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 7 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 8 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line 

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

2007-10-01 Thread Jani Taskinen
janiMon Oct  1 13:41:57 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFB: fix bug #42142 and cs+ws
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.652r2=1.653diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.652 php-src/ext/standard/string.c:1.653
--- php-src/ext/standard/string.c:1.652 Mon Oct  1 12:04:09 2007
+++ php-src/ext/standard/string.c   Mon Oct  1 13:41:57 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.652 2007/10/01 12:04:09 jani Exp $ */
+/* $Id: string.c,v 1.653 2007/10/01 13:41:57 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3317,7 +3317,7 @@
if (*f  str_codepts || (*f  0  -(*f)  str_codepts)) {
ret = 0;
} else if (*l  str_codepts || (*l  0  -(*l)  str_codepts)) {
-   ret = 0;
+   *l = str_codepts;
}
if (((unsigned)(*f) + (unsigned)(*l))  str_codepts) {
*l = str_codepts - *f;
@@ -3414,6 +3414,7 @@
f = Z_LVAL_PP(from);
}
if (argc  3) {
+   SEPARATE_ZVAL(len);
if (Z_TYPE_PP(len) != IS_ARRAY) {
convert_to_long_ex(len);
l = Z_LVAL_PP(len);
@@ -3425,8 +3426,10 @@
}
 
if (Z_TYPE_PP(str) != IS_ARRAY) {
-   if ( (argc == 3  Z_TYPE_PP(from) == IS_ARRAY) ||
-(argc == 4  Z_TYPE_PP(from) != Z_TYPE_PP(len)) ) {
+   if (
+   (argc == 3  Z_TYPE_PP(from) == IS_ARRAY) ||
+   (argc == 4  Z_TYPE_PP(from) != Z_TYPE_PP(len))
+   ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 'from' and 
'len' should be of same type - numerical or array);
RETURN_ZVAL(*str, 1, 0);
}
@@ -3438,7 +3441,6 @@
}
}
 
-
if (Z_TYPE_PP(str) != IS_ARRAY) {
if (Z_TYPE_PP(from) != IS_ARRAY ) {
if (Z_TYPE_PP(repl) == IS_ARRAY) {
@@ -7919,12 +7921,12 @@
offset = (offset  0) ? 0 : offset;
}
 
-   if(offset  s1_len) {
+   if (offset  s1_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, The start 
position cannot exceed initial string length);
RETURN_FALSE;
}
 
-   if(len  s1_len - offset) {
+   if (len  s1_len - offset) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, The 
specified segment exceeds string length);
RETURN_FALSE;
}

-- 
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 /ext/standard/tests/strings wordwrap.phpt

2007-07-23 Thread Jani Taskinen
janiMon Jul 23 11:47:44 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings wordwrap.phpt 
  Log:
  MFB: Fixed Floating point exception inside wordwrap()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.648r2=1.649diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.648 php-src/ext/standard/string.c:1.649
--- php-src/ext/standard/string.c:1.648 Sun Jul 15 19:50:06 2007
+++ php-src/ext/standard/string.c   Mon Jul 23 11:47:44 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.648 2007/07/15 19:50:06 jani Exp $ */
+/* $Id: string.c,v 1.649 2007/07/23 11:47:44 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -856,6 +856,11 @@
RETURN_EMPTY_STRING();
}
 
+   if (breakcharlen == 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Break string 
cannot be empty);
+   RETURN_FALSE;
+   }
+
if (linelength == 0  docut) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Can't force cut 
when width is zero);
RETURN_FALSE;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/wordwrap.phpt?r1=1.7r2=1.8diff_format=u
Index: php-src/ext/standard/tests/strings/wordwrap.phpt
diff -u php-src/ext/standard/tests/strings/wordwrap.phpt:1.7 
php-src/ext/standard/tests/strings/wordwrap.phpt:1.8
--- php-src/ext/standard/tests/strings/wordwrap.phpt:1.7Wed May 19 
08:45:23 2004
+++ php-src/ext/standard/tests/strings/wordwrap.phptMon Jul 23 11:47:44 2007
@@ -27,6 +27,8 @@
 
 123|==1234567890|==123 === wordwrap(123 1234567890 123, 10, |==, 1)
 
+FALSE === @wordwrap(chr(0), 0, )
+
 TESTS;
 
 include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');

-- 
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 /ext/standard/tests/strings str_pad.phpt

2007-07-23 Thread Jani Taskinen
janiMon Jul 23 13:27:34 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings str_pad.phpt 
  Log:
  - Fixed str_pad() when passed huge negative pad_length 
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.649r2=1.650diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.649 php-src/ext/standard/string.c:1.650
--- php-src/ext/standard/string.c:1.649 Mon Jul 23 11:47:44 2007
+++ php-src/ext/standard/string.c   Mon Jul 23 13:27:34 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.649 2007/07/23 11:47:44 jani Exp $ */
+/* $Id: string.c,v 1.650 2007/07/23 13:27:34 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7309,7 +7309,7 @@
}
/* If resulting string turns out to be shorter than input string,
   we simply copy the input and return. */
-   if (num_pad_chars  0) {
+   if (pad_length  0 || num_pad_chars  0) {
if (input_type == IS_UNICODE) {
RETURN_UNICODEL((UChar *)input, input_len, 1);
} else {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_pad.phpt?r1=1.4r2=1.5diff_format=u
Index: php-src/ext/standard/tests/strings/str_pad.phpt

-- 
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 /ext/standard/tests/strings strripos_offset.phpt

2007-07-10 Thread Dmitry Stogov
dmitry  Tue Jul 10 14:16:40 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings strripos_offset.phpt 
  Log:
  Fixed limit warnings in non-unicode mode
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.646r2=1.647diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.646 php-src/ext/standard/string.c:1.647
--- php-src/ext/standard/string.c:1.646 Fri Jun 29 14:53:02 2007
+++ php-src/ext/standard/string.c   Tue Jul 10 14:16:40 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.646 2007/06/29 14:53:02 dmitry Exp $ */
+/* $Id: string.c,v 1.647 2007/07/10 14:16:40 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2788,6 +2788,7 @@
if (offset = 0) {
U16_FWD_N(haystack.u, cu_offset, haystack_len, offset);
if (cu_offset  haystack_len - needle_len) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
u_p = haystack.u + cu_offset;
@@ -2795,11 +2796,13 @@
} else {
u_p = haystack.u;
if (-offset  haystack_len) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
} else {
cu_offset = haystack_len;
U16_BACK_N(haystack.u, 0, cu_offset, -offset);
if (cu_offset == 0) {
+   php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Offset is greater than the length of haystack string);
RETURN_FALSE;
}
if (needle_len  haystack_len - cu_offset) {
@@ -2823,12 +2826,14 @@
} else {
if (offset = 0) {
if (offset  haystack_len) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
p = haystack.s + offset;
e = haystack.s + haystack_len - needle_len;
} else {
if (-offset  haystack_len) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
 
@@ -2913,6 +2918,7 @@
if (offset = 0) {
U16_FWD_N(haystack.u, cu_offset, haystack_len, offset);
if (cu_offset  haystack_len - needle_len) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
}
u_p = haystack.u + cu_offset;
@@ -2920,11 +2926,13 @@
} else {
u_p = haystack.u;
if (-offset  haystack_len || offset  -INT_MAX) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
Offset is greater than the length of haystack string);
RETURN_FALSE;
} else {
cu_offset = haystack_len;
U16_BACK_N(haystack.u, 0, cu_offset, -offset);
if (cu_offset == 0) {
+   php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Offset is greater than the length of haystack string);
RETURN_FALSE;
}
if (needle_len  haystack_len - cu_offset) {
@@ -2951,6 +2959,7 @@
   Can also avoid tolower emallocs */
if (offset = 0) {
if (offset  haystack_len) {
+   php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Offset is greater than the length of haystack string);
RETURN_FALSE;
}
p = haystack.s + offset;
@@ -2958,6 +2967,7 @@
} else {
p = haystack.s;
if (-offset  haystack_len || offset  INT_MAX) 
{
+   php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Offset is greater than the 

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

2007-06-29 Thread Dmitry Stogov
dmitry  Fri Jun 29 14:53:02 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  ord() must not convert binary data to unicode in unicode mode
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.645r2=1.646diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.645 php-src/ext/standard/string.c:1.646
--- php-src/ext/standard/string.c:1.645 Mon Jun 18 13:54:59 2007
+++ php-src/ext/standard/string.c   Fri Jun 29 14:53:02 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.645 2007/06/18 13:54:59 dmitry Exp $ */
+/* $Id: string.c,v 1.646 2007/06/29 14:53:02 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3613,7 +3613,9 @@
WRONG_PARAM_COUNT;
}
 
-   convert_to_text_ex(str);
+   if (Z_TYPE_PP(str) != IS_UNICODE  Z_TYPE_PP(str) != IS_STRING) {
+   convert_to_text_ex(str);
+   }
if (Z_TYPE_PP(str) == IS_UNICODE) {
RETURN_LONG(zend_get_codepoint_at(Z_USTRVAL_PP(str), 
Z_USTRLEN_PP(str), 0));
} else {

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

2007-06-18 Thread Dmitry Stogov
dmitry  Mon Jun 18 11:50:41 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MTH: Fixed bug #40432 (strip_tags() fails with greater than in attribute).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.642r2=1.643diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.642 php-src/ext/standard/string.c:1.643
--- php-src/ext/standard/string.c:1.642 Wed Jun  6 21:55:18 2007
+++ php-src/ext/standard/string.c   Mon Jun 18 11:50:41 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.642 2007/06/06 21:55:18 tony2001 Exp $ */
+/* $Id: string.c,v 1.643 2007/06/18 11:50:41 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6314,6 +6314,7 @@
int32_t idx = 0, tmp, codepts;
UChar32 ch, next, prev1, prev2, last, doctype[6];
int br = 0, depth = 0, state = 0, i;
+   UChar in_q = 0;
 
if (stateptr)
state = *stateptr;
@@ -6389,10 +6390,14 @@
break;
}
 
+   if (in_q) {
+   break;
+   }
+   
switch (state) {
case 1: /* HTML/XML */
last = ch;
-   state = 0;
+   in_q = state = 0;
if (allow_len) {
tp = ((tp-tbuf) = 
UBYTES(PHP_TAG_BUF_SIZE) ? tbuf: tp);
*(tp++) = ch;
@@ -6407,19 +6412,19 @@
 
case 2: /* PHP */
if (!br  last != 0x22  prev1 == 0x3F) { /* 
''  '?' */
-   state = 0;
+   in_q = state = 0;
tp = tbuf;
}
break;
 
case 3:
-   state = 0;
+   in_q = state = 0;
tp = tbuf;
break;
 
case 4: /* JavaScript/CSS/etc... */
if (codepts = 2  prev1 == 0x2D  prev2 == 
0x2D) { /* '-' */
-   state = 0;
+   in_q = state = 0;
tp = tbuf;
}
break;
@@ -6444,6 +6449,13 @@
tp = ((tp-tbuf) = UBYTES(PHP_TAG_BUF_SIZE) ? 
tbuf: tp);
*(tp++) = ch;
}
+   if (state  prev1 != 0x27 /*'\\'*/  (!in_q || ch == 
in_q)) {
+   if (in_q) {
+   in_q = 0;
+   } else {
+   in_q = ch;
+   }
+   }
break;
 
case 0x21: /* '!' */
@@ -6541,7 +6553,7 @@
 PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char 
*allow, int allow_len, zend_bool allow_tag_spaces)
 {
char *tbuf, *buf, *p, *tp, *rp, c, lc;
-   int br, i=0, depth=0;
+   int br, i=0, depth=0, in_q=0;
int state = 0;
 
if (stateptr)
@@ -6615,10 +6627,14 @@
break;
}
 
+   if (in_q) {
+   break;
+   }
+
switch (state) {
case 1: /* HTML/XML */
lc = '';
-   state = 0;
+   in_q = state = 0;
if (allow) {
tp = ((tp-tbuf) = 
PHP_TAG_BUF_SIZE ? tbuf: tp);
*(tp++) = '';
@@ -6633,19 +6649,19 @@
 
case 2: /* PHP */
if (!br  lc != '\'  *(p-1) 
== '?') {
-   state = 0;
+   in_q = state = 0;
tp = tbuf;
}
break;
 
case 3:
-   state = 0;
+  

[PHP-CVS] cvs: php-src /ext/standard string.c /ext/standard/tests/strings bug40754.phpt

2007-06-18 Thread Dmitry Stogov
dmitry  Mon Jun 18 13:39:02 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings bug40754.phpt 
  Log:
  Fixed crash in substr_compare()
  Fixed error messages
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.643r2=1.644diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.643 php-src/ext/standard/string.c:1.644
--- php-src/ext/standard/string.c:1.643 Mon Jun 18 11:50:41 2007
+++ php-src/ext/standard/string.c   Mon Jun 18 13:39:02 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.643 2007/06/18 11:50:41 dmitry Exp $ */
+/* $Id: string.c,v 1.644 2007/06/18 13:39:02 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7208,7 +7208,7 @@
tmp = (char *)p + length;
}
if (tmp  endp) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Offset value %ld exceeds string length, offset);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Length value %ld exceeds string length, length);
RETURN_FALSE;
} else {
endp = tmp;
@@ -7888,8 +7888,13 @@
offset = (offset  0) ? 0 : offset;
}
 
-   if ((offset + len)  s1_len) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The 
specified segment exceeds string length);
+   if(offset  s1_len) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The start 
position cannot exceed initial string length);
+   RETURN_FALSE;
+   }
+
+   if(len  s1_len - offset) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The length 
cannot exceed initial string length);
RETURN_FALSE;
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug40754.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/standard/tests/strings/bug40754.phpt
diff -u php-src/ext/standard/tests/strings/bug40754.phpt:1.2 
php-src/ext/standard/tests/strings/bug40754.phpt:1.3
--- php-src/ext/standard/tests/strings/bug40754.phpt:1.2Tue May 29 
20:11:23 2007
+++ php-src/ext/standard/tests/strings/bug40754.phptMon Jun 18 13:39:02 2007
@@ -32,25 +32,25 @@
 bool(false)
 bool(false)
 
-Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s 
on line %d
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s 
on line %d
 bool(false)
 
 Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
 bool(false)
 
-Warning: stripos(): Offset not contained in string. in %s on line %d
+Warning: stripos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s 
on line %d
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s 
on line %d
 bool(false)
 
-Warning: substr_count(): Length value 2147483647 exceeds string length. in %s 
on line %d
+Warning: substr_count(): Length value 2147483647 exceeds string length in %s 
on line %d
 bool(false)
 
-Warning: strpos(): Offset not contained in string. in %s on line %d
+Warning: strpos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: stripos(): Offset not contained in string. in %s on line %d
+Warning: stripos(): Offset not contained in string in %s on line %d
 bool(false)
 
 Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
@@ -61,3 +61,38 @@
 int(2)
 string(8) abcdeabc
 bool(false)
+--UEXPECTF--   
+unicode(4) bcde
+bool(false)
+bool(false)
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s 
on line %d
+bool(false)
+
+Warning: substr_compare(): The start position cannot exceed initial string 
length in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s 
on line %d
+bool(false)
+
+Warning: substr_count(): Length value 2147483647 exceeds string length in %s 
on line %d
+bool(false)
+
+Warning: strpos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s 
on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s 
on line %d
+bool(false)
+int(2)
+unicode(8) abcdeabc
+bool(false)

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

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

2007-06-18 Thread Dmitry Stogov
dmitry  Mon Jun 18 13:54:59 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fixed error message
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.644r2=1.645diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.644 php-src/ext/standard/string.c:1.645
--- php-src/ext/standard/string.c:1.644 Mon Jun 18 13:39:02 2007
+++ php-src/ext/standard/string.c   Mon Jun 18 13:54:59 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.644 2007/06/18 13:39:02 dmitry Exp $ */
+/* $Id: string.c,v 1.645 2007/06/18 13:54:59 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7894,7 +7894,7 @@
}
 
if(len  s1_len - offset) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, The length 
cannot exceed initial string length);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The 
specified segment exceeds string length);
RETURN_FALSE;
}
 

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

2007-06-06 Thread Stanislav Malyshev
stasWed Jun  6 20:06:43 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MF5: Fix chunk_split fix - avoid using floats
  MF5: Fix money_format - don't give strfmon more arguments then supplied
  MF5: Fix str[c]spn integer overflow
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.640r2=1.641diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.640 php-src/ext/standard/string.c:1.641
--- php-src/ext/standard/string.c:1.640 Tue Jun  5 13:37:05 2007
+++ php-src/ext/standard/string.c   Wed Jun  6 20:06:43 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.640 2007/06/05 13:37:05 tony2001 Exp $ */
+/* $Id: string.c,v 1.641 2007/06/06 20:06:43 stas Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -249,10 +249,14 @@
}
}
 
-   if (((unsigned) start + (unsigned) len)  len1) {
+   if (len  len1 - start) {
len = len1 - start;
}
 
+   if(len == 0) {
+   RETURN_LONG(0);
+   }
+
if (type1 == IS_UNICODE) {
UChar *u_start, *u_end;
int32_t i = 0;
@@ -3083,7 +3087,7 @@
int chunks; /* complete chunks! */
int restlen;
int charsize = sizeof(char);
-   float out_len;
+   int out_len;
 
if (str_type == IS_UNICODE) {
charsize = sizeof(UChar);
@@ -3092,15 +3096,24 @@
chunks = srclen / chunklen;
restlen = srclen - chunks * chunklen; /* srclen % chunklen */
 
+   if(chunks  INT_MAX - 1) {
+   return NULL;
+   }
out_len = chunks + 1;
+   if(endlen !=0  out_len  INT_MAX/endlen) {
+   return NULL;
+   }
out_len *= endlen;
+   if(out_len  INT_MAX - srclen - 1) {
+   return NULL;
+   }
out_len += srclen + 1;
 
-   if ((out_len  INT_MAX || out_len = 0) || ((out_len * charsize)  
INT_MAX || (out_len * charsize) = 0)) {
+   if (out_len  INT_MAX/charsize) {
return NULL;
}
 
-   dest = safe_emalloc((int)out_len, charsize, 0);
+   dest = safe_emalloc(out_len, charsize, 0);
 
for (p = src, q = dest; p  (src + charsize * (srclen - chunklen + 1)); 
) {
memcpy(q, p, chunklen * charsize);
@@ -7654,13 +7667,28 @@
 PHP_FUNCTION(money_format)
 {
int format_len = 0, str_len;
-   char *format, *str;
+   char *format, *str, *p, *e;
double value;
+   zend_bool check = 0;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sd, format, 
format_len, value) == FAILURE) {
return;
}
 
+   p = format;
+   e = p + format_len;
+   while ((p = memchr(p, '%', (e - p {
+   if (*(p + 1) == '%') {
+   p += 2; 
+   } else if (!check) {
+   check = 1;
+   p++;
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Only a 
single %%i or %%n token can be used);
+   RETURN_FALSE;
+   }
+   }
+
str_len = format_len + 1024;
str = emalloc(str_len);
if ((str_len = strfmon(str, str_len, format, value))  0) {

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

2007-06-05 Thread Antony Dovgal
tony2001Tue Jun  5 13:37:05 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix folding
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.639r2=1.640diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.639 php-src/ext/standard/string.c:1.640
--- php-src/ext/standard/string.c:1.639 Sun Jun  3 18:53:51 2007
+++ php-src/ext/standard/string.c   Tue Jun  5 13:37:05 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.639 2007/06/03 18:53:51 iliaa Exp $ */
+/* $Id: string.c,v 1.640 2007/06/05 13:37:05 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -212,7 +212,7 @@
 }
 /* }}} */
 
-static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior)
+static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) 
/* {{{ */
 {
void *s1, *s2;
int len1, len2;
@@ -288,6 +288,7 @@
}
 
 }
+/* }}} */
 
 /* {{{ proto int strspn(string str, string mask [, start [, len]]) U
Finds length of initial segment consisting entirely of characters found in 
mask. If start or/and length is provided works like 
strspn(substr($s,$start,$len),$good_chars) */
@@ -1645,7 +1646,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto string strtotitle(string str) U
Makes a string titlecase */
 PHP_FUNCTION(strtotitle)
@@ -3960,7 +3960,7 @@
 }
 /* }}} */
 
-static HashTable* php_u_strtr_array_prepare_hashtable(HashTable *hash, int 
*minlen_out, int *maxlen_out TSRMLS_DC)
+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;
@@ -4014,6 +4014,7 @@
*maxlen_out = maxlen;
return tmp_hash;
 }
+/* }}} */
 
 /* {{{ php_u_strtr_array
  */
@@ -6516,10 +6517,11 @@
 }
 /* }}} */
 
-PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, 
int allow_len)
+PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, 
int allow_len) /* {{{ */
 {
return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0);
 }
+/* }}} */
 
 /* {{{ php_strip_tags
  */
@@ -7391,7 +7393,6 @@
 U_STRING_DECL(u_rot13_from, 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ, sizeof(rot13_from)-1);
 U_STRING_DECL(u_rot13_to, 
nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM, sizeof(rot13_to)-1);
 
-
 /* {{{ proto string str_rot13(string str) U
Perform the rot13 transform on a string */
 PHP_FUNCTION(str_rot13)
@@ -7422,8 +7423,7 @@
 }
 /* }}} */
 
-
-static void php_string_shuffle(zstr str, int len, zend_uchar str_type 
TSRMLS_DC)
+static void php_string_shuffle(zstr str, int len, zend_uchar str_type 
TSRMLS_DC) /* {{{ */
 {
int rnd_idx, n_left;
char temp;
@@ -7455,7 +7455,7 @@
}
}
 }
-
+/* }}} */
 
 /* {{{ proto void str_shuffle(string str) U
Shuffles string. One permutation of all possible is created */

-- 
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 /ext/standard/tests/strings chunk_split.phpt

2007-06-03 Thread Ilia Alshanetsky
iliaa   Sun Jun  3 18:53:51 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings chunk_split.phpt 
  Log:
  MFB: Corrected fix for CVE-2007-2872
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.638r2=1.639diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.638 php-src/ext/standard/string.c:1.639
--- php-src/ext/standard/string.c:1.638 Wed May 30 00:38:00 2007
+++ php-src/ext/standard/string.c   Sun Jun  3 18:53:51 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.638 2007/05/30 00:38:00 iliaa Exp $ */
+/* $Id: string.c,v 1.639 2007/06/03 18:53:51 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3083,7 +3083,7 @@
int chunks; /* complete chunks! */
int restlen;
int charsize = sizeof(char);
-   int out_len;
+   float out_len;
 
if (str_type == IS_UNICODE) {
charsize = sizeof(UChar);
@@ -3092,13 +3092,15 @@
chunks = srclen / chunklen;
restlen = srclen - chunks * chunklen; /* srclen % chunklen */
 
-   out_len = (srclen + (chunks + 1) * endlen + 1);
+   out_len = chunks + 1;
+   out_len *= endlen;
+   out_len += srclen + 1;
 
if ((out_len  INT_MAX || out_len = 0) || ((out_len * charsize)  
INT_MAX || (out_len * charsize) = 0)) {
return NULL;
}
 
-   dest = safe_emalloc(out_len, charsize, 0);
+   dest = safe_emalloc((int)out_len, charsize, 0);
 
for (p = src, q = dest; p  (src + charsize * (srclen - chunklen + 1)); 
) {
memcpy(q, p, chunklen * charsize);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split.phpt?r1=1.4r2=1.5diff_format=u
Index: php-src/ext/standard/tests/strings/chunk_split.phpt
diff -u php-src/ext/standard/tests/strings/chunk_split.phpt:1.4 
php-src/ext/standard/tests/strings/chunk_split.phpt:1.5
--- php-src/ext/standard/tests/strings/chunk_split.phpt:1.4 Wed May 30 
00:38:00 2007
+++ php-src/ext/standard/tests/strings/chunk_split.phpt Sun Jun  3 18:53:51 2007
@@ -12,6 +12,12 @@
 $c=str_repeat(B, 65535);
 var_dump(chunk_split($a,$b,$c));
 
+$a=str_repeat(B, 65536);
+$b=1;
+$c=str_repeat(B, 65536);
+var_dump(chunk_split($a,$b,$c));
+
+
 ?
 --EXPECT--
 a-b-c-
@@ -25,3 +31,4 @@
 
 test|end
 bool(false)
+bool(false)

-- 
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 /ext/standard/tests/strings chunk_split.phpt

2007-05-29 Thread Ilia Alshanetsky
iliaa   Wed May 30 00:38:00 2007 UTC

  Modified files:  
/php-src/ext/standard/tests/strings chunk_split.phpt 
/php-src/ext/standard   string.c 
  Log:
  
  MFB: Fixed an interger overflow inside chunk_split(), identified by
  Gerhard Wagner
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/chunk_split.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/chunk_split.phpt
diff -u php-src/ext/standard/tests/strings/chunk_split.phpt:1.3 
php-src/ext/standard/tests/strings/chunk_split.phpt:1.4
--- php-src/ext/standard/tests/strings/chunk_split.phpt:1.3 Sun Apr  3 
18:08:40 2005
+++ php-src/ext/standard/tests/strings/chunk_split.phpt Wed May 30 00:38:00 2007
@@ -6,6 +6,12 @@
 echo chunk_split('f', 5).\n;
 echo chunk_split(str_repeat('X', 2*76)).\n;
 echo chunk_split(test, 10, |end) . \n;
+
+$a=str_repeat(B, 65535);
+$b=1;
+$c=str_repeat(B, 65535);
+var_dump(chunk_split($a,$b,$c));
+
 ?
 --EXPECT--
 a-b-c-
@@ -18,3 +24,4 @@
 
 
 test|end
+bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.637r2=1.638diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.637 php-src/ext/standard/string.c:1.638
--- php-src/ext/standard/string.c:1.637 Thu May 24 21:31:35 2007
+++ php-src/ext/standard/string.c   Wed May 30 00:38:00 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.637 2007/05/24 21:31:35 rasmus Exp $ */
+/* $Id: string.c,v 1.638 2007/05/30 00:38:00 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3083,6 +3083,7 @@
int chunks; /* complete chunks! */
int restlen;
int charsize = sizeof(char);
+   int out_len;
 
if (str_type == IS_UNICODE) {
charsize = sizeof(UChar);
@@ -3091,7 +3092,13 @@
chunks = srclen / chunklen;
restlen = srclen - chunks * chunklen; /* srclen % chunklen */
 
-   dest = safe_emalloc((srclen + (chunks + 1) * endlen + 1), charsize, 0);
+   out_len = (srclen + (chunks + 1) * endlen + 1);
+
+   if ((out_len  INT_MAX || out_len = 0) || ((out_len * charsize)  
INT_MAX || (out_len * charsize) = 0)) {
+   return NULL;
+   }
+
+   dest = safe_emalloc(out_len, charsize, 0);
 
for (p = src, q = dest; p  (src + charsize * (srclen - chunklen + 1)); 
) {
memcpy(q, p, chunklen * charsize);

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

2007-05-24 Thread Rasmus Lerdorf
rasmus  Thu May 24 20:56:20 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFB 5_2
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.635r2=1.636diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.635 php-src/ext/standard/string.c:1.636
--- php-src/ext/standard/string.c:1.635 Thu May 10 22:08:35 2007
+++ php-src/ext/standard/string.c   Thu May 24 20:56:20 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.635 2007/05/10 22:08:35 tony2001 Exp $ */
+/* $Id: string.c,v 1.636 2007/05/24 20:56:20 rasmus Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4734,7 +4734,7 @@
 
php_charmask((unsigned char*)what, wlength, flags TSRMLS_CC);
 
-   for (source = str, end = source + length, target = new_str; (c = 
*source) || (source  end); source++) {
+   for (source = str, end = source + length, target = new_str; source  
end; source++) {
if (flags[(unsigned char)c]) {
if ((unsigned char) c  32 || (unsigned char) c  126) {
*target++ = '\\';

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

2007-05-24 Thread Rasmus Lerdorf
rasmus  Thu May 24 21:31:35 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFB 5_2
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.636r2=1.637diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.636 php-src/ext/standard/string.c:1.637
--- php-src/ext/standard/string.c:1.636 Thu May 24 20:56:20 2007
+++ php-src/ext/standard/string.c   Thu May 24 21:31:35 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.636 2007/05/24 20:56:20 rasmus Exp $ */
+/* $Id: string.c,v 1.637 2007/05/24 21:31:35 rasmus Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4735,6 +4735,7 @@
php_charmask((unsigned char*)what, wlength, flags TSRMLS_CC);
 
for (source = str, end = source + length, target = new_str; source  
end; source++) {
+   c = *source;
if (flags[(unsigned char)c]) {
if ((unsigned char) c  32 || (unsigned char) c  126) {
*target++ = '\\';

-- 
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 /ext/standard/tests/strings strripos_offset.phpt

2007-05-10 Thread Antony Dovgal
tony2001Thu May 10 22:08:36 2007 UTC

  Added files: 
/php-src/ext/standard/tests/strings strripos_offset.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix segfault in strripos() when offset == INT_MAX+1
  identified and repoted by Joxean Koret
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.634r2=1.635diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.634 php-src/ext/standard/string.c:1.635
--- php-src/ext/standard/string.c:1.634 Sun Apr 22 19:22:19 2007
+++ php-src/ext/standard/string.c   Thu May 10 22:08:35 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.634 2007/04/22 19:22:19 tony2001 Exp $ */
+/* $Id: string.c,v 1.635 2007/05/10 22:08:35 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2915,7 +2915,7 @@
u_e = haystack.u + haystack_len - needle_len;
} else {
u_p = haystack.u;
-   if (-offset  haystack_len) {
+   if (-offset  haystack_len || -offset  0) {
RETURN_FALSE;
} else {
cu_offset = haystack_len;
@@ -2953,7 +2953,7 @@
e = haystack.s + haystack_len - 1;
} else {
p = haystack.s;
-   if (-offset  haystack_len) {
+   if (-offset  haystack_len || -offset  0) {
RETURN_FALSE;
} else {
e = haystack.s + haystack_len + offset;
@@ -2984,7 +2984,7 @@
p = haystack_dup + offset;
e = haystack_dup + haystack_len - needle_len;
} else {
-   if (-offset  haystack_len) {
+   if (-offset  haystack_len || -offset  0) {
efree(haystack_dup);
efree(needle_dup);
RETURN_FALSE;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strripos_offset.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/strripos_offset.phpt
+++ php-src/ext/standard/tests/strings/strripos_offset.phpt
--TEST--
strripos() offset integer overflow
--FILE--
?php

var_dump(strripos(t, t, PHP_INT_MAX+1));
var_dump(strripos(, tt, PHP_INT_MAX+1));
var_dump(strripos(100, 101, PHP_INT_MAX+1));
var_dump(strripos(1024, 1024, PHP_INT_MAX+1));
var_dump(strripos(array(), array(), PHP_INT_MAX+1));
var_dump(strripos(1024, 1024, -PHP_INT_MAX));
var_dump(strripos(1024, te, -PHP_INT_MAX));
var_dump(strripos(1024, 1024, -PHP_INT_MAX-1));
var_dump(strripos(1024, te, -PHP_INT_MAX-1));

echo Done\n;
?
--EXPECTF-- 
bool(false)
bool(false)
bool(false)
bool(false)

Warning: strripos() expects parameter 1 to be string (Unicode or binary), array 
given in %s on line %d
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Done
--UEXPECTF--
bool(false)
bool(false)
bool(false)
bool(false)

Warning: strripos() expects parameter 1 to be string (Unicode or binary), array 
given in %s on line %d
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Done

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

2007-04-22 Thread Antony Dovgal
tony2001Sun Apr 22 19:22:19 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix [l]trim() in unicode mode
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.633r2=1.634diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.633 php-src/ext/standard/string.c:1.634
--- php-src/ext/standard/string.c:1.633 Mon Mar 26 10:23:49 2007
+++ php-src/ext/standard/string.c   Sun Apr 22 19:22:19 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.633 2007/03/26 10:23:49 tony2001 Exp $ */
+/* $Id: string.c,v 1.634 2007/04/22 19:22:19 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -718,6 +718,9 @@
if ( what ) {
what = eustrndup(what, what_len);
php_expand_uchar_range(what, what_len TSRMLS_CC);
+   } else {
+   what = USTR_MAKE( \n\r\t\v\0);
+   what_len = sizeof( \n\r\t\v\0) - 1;
}
 
if ( mode  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 string.c /ext/standard/tests/strings bug40915.phpt

2007-03-26 Thread Antony Dovgal
tony2001Mon Mar 26 10:23:50 2007 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug40915.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #40915 (addcslashes unexpected behavior with binary input)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.632r2=1.633diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.632 php-src/ext/standard/string.c:1.633
--- php-src/ext/standard/string.c:1.632 Sat Feb 24 16:25:55 2007
+++ php-src/ext/standard/string.c   Mon Mar 26 10:23:49 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.632 2007/02/24 16:25:55 helly Exp $ */
+/* $Id: string.c,v 1.633 2007/03/26 10:23:49 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4555,8 +4555,8 @@
RETURN_STRINGL(str, str_len, 1);
}
 
-   RETURN_STRING(php_addcslashes(str, str_len, Z_STRLEN_P(return_value), 
0,
- what, 
what_len TSRMLS_CC), 0);
+   Z_STRVAL_P(return_value) = php_addcslashes(str, str_len, 
Z_STRLEN_P(return_value), 0, what, what_len TSRMLS_CC);
+   RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 0);
 }
 /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug40915.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug40915.phpt
+++ php-src/ext/standard/tests/strings/bug40915.phpt
--TEST--
Bug #40915 (addcslashes unexpected behavior with binary input)
--FILE--
?php

$str = (binary)a\000z;

var_dump(addslashes($str));
var_dump(addcslashes($str, (binary)));
var_dump(addcslashes($str, (binary)\000z));
var_dump(addcslashes( $str, (binary)z));

echo Done\n;
?
--EXPECTF-- 
string(4) a\0z
string(3) a
string(7) a\000\z
string(4) a
Done
--UEXPECTF--
unicode(4) a\0z
string(3) a
string(7) a\000\z
string(4) a
Done

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

2007-02-09 Thread Antony Dovgal
tony2001Sat Feb 10 00:48:18 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix off-by-one accidentally introduced by safe_emalloc() patch
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.630r2=1.631diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.630 php-src/ext/standard/string.c:1.631
--- php-src/ext/standard/string.c:1.630 Mon Jan  8 14:25:49 2007
+++ php-src/ext/standard/string.c   Sat Feb 10 00:48:17 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.630 2007/01/08 14:25:49 iliaa Exp $ */
+/* $Id: string.c,v 1.631 2007/02/10 00:48:17 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4914,7 +4914,7 @@
}
 
Z_STRLEN_P(result) = len + (char_count * (to_len - 1));
-   Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len);
+   Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len + 1);
Z_TYPE_P(result) = IS_STRING;
 
if (case_sensitivity) {

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

2007-01-08 Thread Ilia Alshanetsky
iliaa   Mon Jan  8 14:25:49 2007 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  
  MFB: Use safe_emalloc() rather then emalloc()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.629r2=1.630diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.629 php-src/ext/standard/string.c:1.630
--- php-src/ext/standard/string.c:1.629 Mon Jan  1 09:29:32 2007
+++ php-src/ext/standard/string.c   Mon Jan  8 14:25:49 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.629 2007/01/01 09:29:32 sebastian Exp $ */
+/* $Id: string.c,v 1.630 2007/01/08 14:25:49 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4914,7 +4914,7 @@
}
 
Z_STRLEN_P(result) = len + (char_count * (to_len - 1));
-   Z_STRVAL_P(result) = target = emalloc(Z_STRLEN_P(result) + 1);
+   Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len);
Z_TYPE_P(result) = IS_STRING;
 
if (case_sensitivity) {

-- 
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-12-20 Thread Antony Dovgal
tony2001Wed Dec 20 23:30:11 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  do not allocate the return value if it wasn't requested
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.624r2=1.625diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.624 php-src/ext/standard/string.c:1.625
--- php-src/ext/standard/string.c:1.624 Tue Dec 19 21:38:59 2006
+++ php-src/ext/standard/string.c   Wed Dec 20 23:30:11 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.624 2006/12/19 21:38:59 andrei Exp $ */
+/* $Id: string.c,v 1.625 2006/12/20 23:30:11 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1679,7 +1679,7 @@
  */
 PHPAPI void php_u_basename(UChar *s, int len, UChar *suffix, int sufflen, 
UChar **p_ret, int *p_len TSRMLS_DC)
 {
-   UChar *ret = NULL, *end, *c, *comp, *cend;
+   UChar *end, *c, *comp, *cend;
int state;
 
c = comp = cend = s;
@@ -1713,10 +1713,9 @@
}
 
len = cend - comp;
-   ret = eustrndup(comp, len);
 
if (p_ret) {
-   *p_ret = ret;
+   *p_ret = eustrndup(comp, len);
}
if (p_len) {
*p_len = len;
@@ -1784,11 +1783,10 @@
}
 
len = cend - comp;
-   ret = emalloc(len + 1);
-   memcpy(ret, comp, len);
-   ret[len] = '\0';
-
if (p_ret) {
+   ret = emalloc(len + 1);
+   memcpy(ret, comp, len);
+   ret[len] = '\0';
*p_ret = ret;
}
if (p_len) {

-- 
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 string.c

2006-12-13 Thread Derick Rethans
On Thu, 30 Nov 2006, Andrei Zmievski wrote:

 andreiThu Nov 30 21:20:56 2006 UTC
 
   Modified files:  
 /php-src/ext/standard string.c 
   Log:
   Mark strtr() as Unicode-safe.
   
   # Right, Derick?

Yes, affirmative.

Derick

-- 
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-12-12 Thread Andrei Zmievski
andrei  Tue Dec 12 18:17:57 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Make hebrev(c) support only binary strings.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.620r2=1.621diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.620 php-src/ext/standard/string.c:1.621
--- php-src/ext/standard/string.c:1.620 Wed Dec  6 23:14:15 2006
+++ php-src/ext/standard/string.c   Tue Dec 12 18:17:56 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.620 2006/12/06 23:14:15 pollita Exp $ */
+/* $Id: string.c,v 1.621 2006/12/12 18:17:56 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -5659,42 +5659,27 @@
  */
 static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
 {
-   zval **str, **max_chars_per_line;
+   char *str;
+   int str_len;
char *heb_str, *tmp, *target, *broken_str;
int block_start, block_end, block_type, block_length, i;
long max_chars=0;
int begin, end, char_count, orig_begin;
 
 
-   switch (ZEND_NUM_ARGS()) {
-   case 1:
-   if (zend_get_parameters_ex(1, str) == FAILURE) {
-   RETURN_FALSE;
-   }
-   break;
-   case 2:
-   if (zend_get_parameters_ex(2, str, 
max_chars_per_line) == FAILURE) {
-   RETURN_FALSE;
-   }
-   convert_to_long_ex(max_chars_per_line);
-   max_chars = Z_LVAL_PP(max_chars_per_line);
-   break;
-   default:
-   WRONG_PARAM_COUNT;
-   break;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|l, str, 
str_len, max_chars) == FAILURE) {
+   return;
}
-
-   convert_to_string_ex(str);
-
-   if (Z_STRLEN_PP(str) == 0) {
+   
+   if (str_len == 0) {
RETURN_FALSE;
}
 
-   tmp = Z_STRVAL_PP(str);
+   tmp = str;
block_start=block_end=0;
 
-   heb_str = (char *) emalloc(Z_STRLEN_PP(str)+1);
-   target = heb_str+Z_STRLEN_PP(str);
+   heb_str = (char *) emalloc(str_len+1);
+   target = heb_str+str_len;
*target = 0;
target--;
 
@@ -5708,13 +5693,13 @@
 
do {
if (block_type == _HEB_BLOCK_TYPE_HEB) {
-   while ((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) 
|| ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' )  
block_endZ_STRLEN_PP(str)-1) {
+   while ((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) 
|| ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' )  block_endstr_len-1) {
tmp++;
block_end++;
block_length++;
}
for (i = block_start; i= block_end; i++) {
-   *target = Z_STRVAL_PP(str)[i];
+   *target = str[i];
switch (*target) {
case '(':
*target = ')';
@@ -5753,7 +5738,7 @@
}
block_type = _HEB_BLOCK_TYPE_ENG;
} else {
-   while (!isheb(*(tmp+1))  (int)*(tmp+1)!='\n'  
block_end  Z_STRLEN_PP(str)-1) {
+   while (!isheb(*(tmp+1))  (int)*(tmp+1)!='\n'  
block_end  str_len-1) {
tmp++;
block_end++;
block_length++;
@@ -5763,17 +5748,17 @@
block_end--;
}
for (i = block_end; i = block_start; i--) {
-   *target = Z_STRVAL_PP(str)[i];
+   *target = str[i];
target--;
}
block_type = _HEB_BLOCK_TYPE_HEB;
}
block_start=block_end+1;
-   } while (block_end  Z_STRLEN_PP(str)-1);
+   } while (block_end  str_len-1);
 
 
-   broken_str = (char *) emalloc(Z_STRLEN_PP(str)+1);
-   begin=end=Z_STRLEN_PP(str)-1;
+   broken_str = (char *) emalloc(str_len+1);
+   begin=end=str_len-1;
target = broken_str;
 
while (1) {
@@ -5832,17 +5817,17 @@
efree(heb_str);
 
if (convert_newlines) {
-   php_char_to_str(broken_str, Z_STRLEN_PP(str),'\n', br /\n, 
7, return_value);
+   php_char_to_str(broken_str, str_len,'\n', br /\n, 7, 
return_value);
efree(broken_str);
} else {
Z_STRVAL_P(return_value) = 

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

2006-12-06 Thread Sara Golemon
pollita Wed Dec  6 23:14:15 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Use proper zstr for str_getcsv() and add documentation for Andrei's peace of 
mind
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.619r2=1.620diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.619 php-src/ext/standard/string.c:1.620
--- php-src/ext/standard/string.c:1.619 Tue Dec  5 04:52:44 2006
+++ php-src/ext/standard/string.c   Wed Dec  6 23:14:15 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.619 2006/12/05 04:52:44 pollita Exp $ */
+/* $Id: string.c,v 1.620 2006/12/06 23:14:15 pollita Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6742,7 +6742,7 @@
 PHP_FUNCTION(str_getcsv)
 {
zend_uchar str_type, delim_type = IS_STRING, enc_type = IS_STRING, 
esc_type = IS_STRING;
-   char *str, *delim = ,, *enc = \, *esc = \\;
+   zstr str, delim = ZSTR(,), enc = ZSTR(\), esc = ZSTR(\\);
int str_len, delim_len = 1, enc_len = 1, esc_len = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, T|TTT,
@@ -6756,23 +6756,35 @@
if (str_type == IS_UNICODE) {
UChar udelim = ',', uenc = '', uesc = '\\';
 
-   /* Non-passed params would need to be upconverted, but we can 
cheat with some local declarations */
+   /* When a unicode string is passed for the main argument,
+* the 'T' specifiers will atuomatically align any remaining
+* arguments that are actually passed to be Unicode as well.
+*
+* However, since they are optional, they may have reached
+* this point still in IS_STRING form (because they wern't 
passed).
+*
+* The clean way to handle this would be to use 
zend_string_to_unicode()
+* to convert the binary defaults to their unicode counterparts.
+*
+* However, since these are simple fixed constants, it's cheaper
+* to declare them as UChars locally and point at these 
versions.
+*/
if (delim_type == IS_STRING) {
-   delim = (char*)udelim;
+   delim.u = udelim;
delim_len = 1;
}
if (enc_type == IS_STRING) {
-   enc = (char*)uenc;
+   enc.u = uenc;
enc_len = 1;
}
if (esc_type == IS_STRING) {
-   esc = (char*)uesc;
+   esc.u = uesc;
esc_len = 1;
}
 
-   php_u_fgetcsv(NULL, (UChar*)delim, delim_len, (UChar*)enc, 
enc_len, (UChar*)esc, esc_len, (UChar*)str, str_len, return_value TSRMLS_CC);
+   php_u_fgetcsv(NULL, delim.u, delim_len, enc.u, enc_len, esc.u, 
esc_len, str.u, str_len, return_value TSRMLS_CC);
} else {
-   php_fgetcsv_ex(NULL, delim, delim_len, enc, enc_len, esc, 
esc_len, str, str_len, return_value TSRMLS_CC);
+   php_fgetcsv_ex(NULL, delim.s, delim_len, enc.s, enc_len, esc.s, 
esc_len, str.s, str_len, return_value TSRMLS_CC);
}
 }
 /* }}} */

-- 
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-11-30 Thread Andrei Zmievski
andrei  Thu Nov 30 21:20:56 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Mark strtr() as Unicode-safe.
  
  # Right, Derick?
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.614r2=1.615diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.614 php-src/ext/standard/string.c:1.615
--- php-src/ext/standard/string.c:1.614 Fri Nov 24 21:57:31 2006
+++ php-src/ext/standard/string.c   Thu Nov 30 21:20:56 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.614 2006/11/24 21:57:31 tony2001 Exp $ */
+/* $Id: string.c,v 1.615 2006/11/30 21:20:56 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4174,7 +4174,7 @@
 }
 /* }}} */
 
-/* {{{ proto string strtr(string str, string from[, string to])
+/* {{{ proto string strtr(string str, string from[, string to]) U
Translates characters in str using given translation tables */
 PHP_FUNCTION(strtr)
 {

-- 
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-11-30 Thread Andrei Zmievski
andrei  Thu Nov 30 21:46:54 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Mark setlocale() as Unicode-safe. It shouldn't be used in
  unicode.semantics=on mode anyway.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.615r2=1.616diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.615 php-src/ext/standard/string.c:1.616
--- php-src/ext/standard/string.c:1.615 Thu Nov 30 21:20:56 2006
+++ php-src/ext/standard/string.c   Thu Nov 30 21:46:54 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.615 2006/11/30 21:20:56 andrei Exp $ */
+/* $Id: string.c,v 1.616 2006/11/30 21:46:54 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6006,7 +6006,7 @@
 }
 /* }}} */
 
-/* {{{ proto string setlocale(mixed category, string locale [, string ...])
+/* {{{ proto string setlocale(mixed category, string locale [, string ...]) U
Set locale information */
 PHP_FUNCTION(setlocale)
 {



-- 
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 /ext/standard/tests/strings bug39621.phpt

2006-11-24 Thread Antony Dovgal
tony2001Fri Nov 24 21:57:31 2006 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug39621.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #39621 (str_replace() is not binary safe on strings with equal length)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.613r2=1.614diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.613 php-src/ext/standard/string.c:1.614
--- php-src/ext/standard/string.c:1.613 Fri Nov 17 16:45:28 2006
+++ php-src/ext/standard/string.c   Fri Nov 24 21:57:31 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.613 2006/11/17 16:45:28 andrei Exp $ */
+/* $Id: string.c,v 1.614 2006/11/24 21:57:31 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -5150,16 +5150,33 @@
new_str = estrndup(haystack, length);
return new_str;
} else {
-   if (case_sensitivity ? strncmp(haystack, needle, length) : 
strncasecmp(haystack, needle, length)) {
+   if (case_sensitivity  memcmp(haystack, needle, length)) {
goto nothing_todo;
-   } else {
-   *_new_length = str_len;
-   new_str = estrndup(str, str_len);
-   if (replace_count) {
-   (*replace_count)++;
+   } else if (!case_sensitivity) {
+   char *l_haystack, *l_needle;
+
+   l_haystack = estrndup(haystack, length);
+   l_needle = estrndup(needle, length);
+
+   php_strtolower(l_haystack, length);
+   php_strtolower(l_needle, length);
+
+   if (memcmp(l_haystack, l_needle, length)) {
+   efree(l_haystack);
+   efree(l_needle);
+   goto nothing_todo;
}
-   return new_str;
+   efree(l_haystack);
+   efree(l_needle);
+   }
+
+   *_new_length = str_len;
+   new_str = estrndup(str, str_len);
+
+   if (replace_count) {
+   (*replace_count)++;
}
+   return new_str;
}
 
 }
@@ -5253,7 +5270,7 @@
new_str = eustrndup(haystack, length);
return new_str;
} else {
-   if (u_strncmp(haystack, needle, length)) {
+   if (u_memcmp(haystack, needle, length)) {
goto nothing_todo;
} else {
*_new_length = repl_len;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug39621.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug39621.phpt
+++ php-src/ext/standard/tests/strings/bug39621.phpt
--TEST--
Bug #39621 (str_replace() is not binary safe on strings with equal length)
--FILE--
?php

$search =  qxxx\0;
$subject = qxxx\0;
$replace = any text;

$result = str_replace ( $search, $replace, $subject );

var_dump($result);

$search =  QXXX\0;
$subject = qxxx\0;
$replace = any text;

$result = str_ireplace ( $search, $replace, $subject );

var_dump($result);

$search =  qxxx\0;
$subject = qxxx\0;
$replace = any text;

$result = str_replace ( $search, $replace, $subject );

var_dump($result);

$search =  qXxx\0xXxXxXxx;
$subject = qxXx\0;
$replace = any text;

$result = str_ireplace ( $search, $replace, $subject );

var_dump($result);

echo Done\n;
?
--EXPECTF-- 
string(13) qxxx
string(13) qxxx
string(8) any text
string(8) any text
Done
--UEXPECTF--
unicode(13) qxxx
unicode(13) qxxx
unicode(8) any text
unicode(8) any text
Done

-- 
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-11-17 Thread Andrei Zmievski
andrei  Fri Nov 17 16:44:23 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix memory leaks and segfault.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.611r2=1.612diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.611 php-src/ext/standard/string.c:1.612
--- php-src/ext/standard/string.c:1.611 Thu Nov 16 20:33:44 2006
+++ php-src/ext/standard/string.c   Fri Nov 17 16:44:23 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.611 2006/11/16 20:33:44 derick Exp $ */
+/* $Id: string.c,v 1.612 2006/11/17 16:44:23 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3905,7 +3905,7 @@
UChar *key_string;
 
tmp_hash = emalloc(sizeof(HashTable));
-   zend_hash_init(tmp_hash, 0, ZVAL_PTR_DTOR, NULL, 0);
+   zend_hash_init(tmp_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
 
/* Loop over the two strings and prepare the hash entries */
do
@@ -3922,7 +3922,8 @@
}
 
MAKE_STD_ZVAL(entry);
-   ZVAL_UNICODEL(entry, str_to + prev_to_offset, 
to_cp_offset - prev_to_offset, 0);
+   ZVAL_UNICODEL(entry, str_to + prev_to_offset, 
to_cp_offset - prev_to_offset, 1);
+   Z_USTRVAL_P(entry)[to_cp_offset - 
prev_to_offset] = 0;
 
key_string = eumalloc(from_cp_offset - 
prev_from_offset + 1);
memcpy(key_string, str_from + prev_from_offset, 
UBYTES(from_cp_offset - prev_from_offset));

-- 
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-11-17 Thread Andrei Zmievski
andrei  Fri Nov 17 16:45:28 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Use u_memcpy() instead of memcpy().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.612r2=1.613diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.612 php-src/ext/standard/string.c:1.613
--- php-src/ext/standard/string.c:1.612 Fri Nov 17 16:44:23 2006
+++ php-src/ext/standard/string.c   Fri Nov 17 16:45:28 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.612 2006/11/17 16:44:23 andrei Exp $ */
+/* $Id: string.c,v 1.613 2006/11/17 16:45:28 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3926,7 +3926,7 @@
Z_USTRVAL_P(entry)[to_cp_offset - 
prev_to_offset] = 0;
 
key_string = eumalloc(from_cp_offset - 
prev_from_offset + 1);
-   memcpy(key_string, str_from + prev_from_offset, 
UBYTES(from_cp_offset - prev_from_offset));
+   u_memcpy(key_string, str_from + 
prev_from_offset, from_cp_offset - prev_from_offset);
key_string[from_cp_offset - prev_from_offset] = 
0;
 
zend_u_hash_add(tmp_hash, IS_UNICODE, 
ZSTR(key_string), from_cp_offset - prev_from_offset + 1, entry, sizeof(zval*), 
NULL);
@@ -4020,7 +4020,7 @@
}
 
found = 0;
-   memcpy(key, str+pos, UBYTES(maxlen));
+   u_memcpy(key, str+pos, maxlen);
 
for (len = maxlen; len = minlen; len--) {
key[len] = 0;

-- 
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 /ext/standard/tests/strings strtr2.phpt

2006-11-16 Thread Derick Rethans
derick  Thu Nov 16 20:33:44 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings strtr2.phpt 
  Log:
  - Add the strtr implementation for unicode for the case where there are
characters with a code point value = 256.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.610r2=1.611diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.610 php-src/ext/standard/string.c:1.611
--- php-src/ext/standard/string.c:1.610 Fri Nov 10 12:01:50 2006
+++ php-src/ext/standard/string.c   Thu Nov 16 20:33:44 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.610 2006/11/10 12:01:50 andrei Exp $ */
+/* $Id: string.c,v 1.611 2006/11/16 20:33:44 derick Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3805,6 +3805,43 @@
 
 /* {{{ php_u_strtr
  */
+static void text_iter_helper_move(UChar *text, int32_t text_len, int32_t 
*offset, int32_t *cp_offset)
+{
+UChar32 cp;
+int32_t tmp, tmp2;
+
+if (*offset == UBRK_DONE) {
+return;
+}
+
+   if (*offset == text_len) {
+   *offset= UBRK_DONE;
+   *cp_offset = UBRK_DONE;
+   } else {
+   U16_NEXT(text, (*offset), text_len, cp);
+   (*cp_offset)++;
+   


+   if (u_getCombiningClass(cp) == 0) {
+   tmp = *offset;
+   tmp2 = *cp_offset;
+   /*
+* At the end of the from cp will be 0 because of the 
NULL
+* terminating NULL, so combining class will be 0 as 
well.
+*/
+   while (tmp  text_len) {
+   U16_NEXT(text, tmp, text_len, cp);
+   tmp2++;
+   if (u_getCombiningClass(cp) == 0) {
+   break;
+   } else {
+   *offset= tmp;
+   *cp_offset = tmp2;
+   }
+   }
+   }
+   }
+}
+
 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;
@@ -3861,19 +3898,43 @@
 * array in such a way that we can reuse the code in 
php_u_strtr_array
 * to do the replacements in order to avoid duplicating code. */
HashTable *tmp_hash;
-   int minlen = 128*1024, maxlen;
-   zval *tmp;
-   UChar x[2] = { 0, };
+   int minlen = 128*1024, maxlen = 0;
+   int32_t prev_from_offset = 0, from_offset = 0, from_cp_offset = 
0;
+   int32_t prev_to_offset = 0, to_offset = 0, to_cp_offset = 0;
+   zval *entry;
+   UChar *key_string;
 
tmp_hash = emalloc(sizeof(HashTable));
-   zend_hash_init(tmp_hash, 0, NULL, NULL, 0);
+   zend_hash_init(tmp_hash, 0, ZVAL_PTR_DTOR, NULL, 0);
 
/* Loop over the two strings and prepare the hash entries */
-   MAKE_STD_ZVAL(tmp);
-   x[0] = (UChar) 0x58 /*'X'*/;
-   ZVAL_UNICODEL(tmp, x, 1, 1);
-   minlen = maxlen = 1;
-   zend_u_hash_add(tmp_hash, IS_UNICODE, ZSTR(a), 2, tmp, 
sizeof(zval *), NULL);
+   do
+   {
+   text_iter_helper_move(str_from, str_from_len, 
from_offset, from_cp_offset);
+   text_iter_helper_move(str_to, str_to_len, to_offset, 
to_cp_offset);
+
+   if (from_offset != -1  to_offset != -1) {
+   if (from_cp_offset - prev_from_offset  maxlen) 
{
+   maxlen = from_cp_offset - 
prev_from_offset;
+   }
+   if (from_cp_offset - prev_from_offset  minlen) 
{
+   minlen = from_cp_offset - 
prev_from_offset;
+   }
+
+   MAKE_STD_ZVAL(entry);
+   ZVAL_UNICODEL(entry, str_to + prev_to_offset, 
to_cp_offset - prev_to_offset, 0);
+
+   key_string = eumalloc(from_cp_offset - 
prev_from_offset + 1);
+   memcpy(key_string, str_from + prev_from_offset, 
UBYTES(from_cp_offset - prev_from_offset));
+   key_string[from_cp_offset - prev_from_offset] = 
0;
+
+   

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

2006-11-10 Thread Andrei Zmievski
andrei  Fri Nov 10 12:01:50 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Allow mixing Unicode/binary string types.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.609r2=1.610diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.609 php-src/ext/standard/string.c:1.610
--- php-src/ext/standard/string.c:1.609 Wed Oct 11 14:30:50 2006
+++ php-src/ext/standard/string.c   Fri Nov 10 12:01:50 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.609 2006/10/11 14:30:50 iliaa Exp $ */
+/* $Id: string.c,v 1.610 2006/11/10 12:01:50 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1179,26 +1179,12 @@
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)tmp, 
pos) == SUCCESS) {
if (Z_TYPE_PP(tmp) != return_type) {
if (return_type == IS_UNICODE) {
-   if (Z_TYPE_PP(tmp) == IS_STRING) {
-   /* ERROR */
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING,
-
Cannot mix binary strings with other string types);
-   efree(Z_USTRVAL_P(retval));
-   ZVAL_FALSE(retval);
-   return;
-   } else {
+   if (Z_TYPE_PP(tmp) != IS_UNICODE) {
SEPARATE_ZVAL(tmp);
convert_to_unicode_ex(tmp);
}
} else if (return_type == IS_STRING) {
-   if (Z_TYPE_PP(tmp) == IS_UNICODE) {
-   /* ERROR */
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING,
-
Cannot mix binary strings with other string types);
-   efree(Z_STRVAL_P(retval));
-   ZVAL_FALSE(retval);
-   return;
-   } else {
+   if (Z_TYPE_PP(tmp) != IS_STRING) {
SEPARATE_ZVAL(tmp);
convert_to_string_ex(tmp);
}

-- 
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 /ext/standard/tests/strings str_word_count.phpt str_word_count1.phpt

2006-10-11 Thread Antony Dovgal
tony2001Wed Oct 11 13:14:08 2006 UTC

  Added files: 
/php-src/ext/standard/tests/strings str_word_count1.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings str_word_count.phpt 
  Log:
  avoid reading str[-1], add warning when invalid format specified
  add test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.607r2=1.608diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.607 php-src/ext/standard/string.c:1.608
--- php-src/ext/standard/string.c:1.607 Sun Oct  8 13:34:24 2006
+++ php-src/ext/standard/string.c   Wed Oct 11 13:14:07 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.607 2006/10/08 13:34:24 bjori Exp $ */
+/* $Id: string.c,v 1.608 2006/10/11 13:14:07 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7358,7 +7358,7 @@
idx++;
}
/* last character cannot be -, unless explicitly allowed by the user */
-   if (str[str_len-1] == (UChar)0x2d /*'-'*/ 
+   if (str_len  str[str_len-1] == (UChar)0x2d /*'-'*/ 
(!char_list || !u_memchr(char_list, 0x2d /*'-'*/, 
char_list_len))) {
str_len--;
}
@@ -7422,7 +7422,7 @@
p++;
}
/* last character cannot be -, unless explicitly allowed by the user */
-   if (*(e - 1) == '-'  (!char_list || !ch['-'])) {
+   if (str_len  *(e - 1) == '-'  (!char_list || !ch['-'])) {
e--;
}
 
@@ -7477,8 +7477,17 @@
return;
}
 
-   if (type == 1 || type == 2) {
-   array_init(return_value);
+   switch (type) {
+   case 1:
+   case 2:
+   array_init(return_value);
+   break;
+   case 0:
+   /* nothing to be done */
+   break;
+   default:
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
format value %ld, type);
+   RETURN_FALSE;
}
 
if (str_type == IS_UNICODE) {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_word_count.phpt?r1=1.8r2=1.9diff_format=u
Index: php-src/ext/standard/tests/strings/str_word_count.phpt
diff -u php-src/ext/standard/tests/strings/str_word_count.phpt:1.8 
php-src/ext/standard/tests/strings/str_word_count.phpt:1.9
--- php-src/ext/standard/tests/strings/str_word_count.phpt:1.8  Mon Aug 28 
19:52:01 2006
+++ php-src/ext/standard/tests/strings/str_word_count.phpt  Wed Oct 11 
13:14:08 2006
@@ -41,6 +41,8 @@
 var_dump(str_word_count('foo', 2, '));
 var_dump(str_word_count(-foo-, 2));
 var_dump(str_word_count(-foo-, 2, -));
+
+echo Done\n;
 ?
 --EXPECTF--
 array(6) {
@@ -72,10 +74,18 @@
   string(5) today
 }
 int(6)
-NULL
-NULL
-NULL
-NULL
+
+Warning: str_word_count(): Invalid format value 3 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value 123 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value -1 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value 1569325056 in %s on line %d
+bool(false)
 
 Warning: str_word_count() expects parameter 2 to be long, array given in %s on 
line %d
 NULL
@@ -236,6 +246,7 @@
   [0]=
   string(5) -foo-
 }
+Done
 --UEXPECTF--
 array(6) {
   [0]=
@@ -266,10 +277,18 @@
   unicode(5) today
 }
 int(6)
-NULL
-NULL
-NULL
-NULL
+
+Warning: str_word_count(): Invalid format value 3 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value 123 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value -1 in %s on line %d
+bool(false)
+
+Warning: str_word_count(): Invalid format value 1569325056 in %s on line %d
+bool(false)
 
 Warning: str_word_count() expects parameter 2 to be long, array given in %s on 
line %d
 NULL
@@ -430,3 +449,4 @@
   [0]=
   unicode(5) -foo-
 }
+Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_word_count1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/str_word_count1.phpt
+++ php-src/ext/standard/tests/strings/str_word_count1.phpt
--TEST--
str_word_count() and invalid arguments
--FILE--
?php

var_dump(str_word_count());
var_dump(str_word_count(, -1));
var_dump(str_word_count(, -1, $a));
var_dump($a);

echo Done\n;
?
--EXPECTF-- 
int(0)

Warning: str_word_count(): Invalid format value -1 in %s on line %d
bool(false)

Notice: Undefined variable: a in %s on line %d

Warning: str_word_count(): Invalid format value -1 in %s on line %d
bool(false)

Notice: Undefined variable: a in %s on line %d
NULL
Done

-- 
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-10-11 Thread Ilia Alshanetsky
iliaa   Wed Oct 11 14:30:50 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFB:  Catch empty strings right away.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.608r2=1.609diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.608 php-src/ext/standard/string.c:1.609
--- php-src/ext/standard/string.c:1.608 Wed Oct 11 13:14:07 2006
+++ php-src/ext/standard/string.c   Wed Oct 11 14:30:50 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.608 2006/10/11 13:14:07 tony2001 Exp $ */
+/* $Id: string.c,v 1.609 2006/10/11 14:30:50 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -7478,16 +7478,22 @@
}
 
switch (type) {
-   case 1:
-   case 2:
-   array_init(return_value);
-   break;
-   case 0:
-   /* nothing to be done */
-   break;
-   default:
+   case 1:
+   case 2:
+   array_init(return_value);
+   if (!str_len) {
+   return;
+   }
+   break;
+   case 0:
+   if (!str_len) {
+   RETURN_LONG(0);
+   }
+   break;
+   default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid 
format value %ld, type);
RETURN_FALSE;
+   break;
}
 
if (str_type == IS_UNICODE) {

-- 
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-10-05 Thread Andrei Zmievski
andrei  Thu Oct  5 22:44:31 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  TODO
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.605r2=1.606diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.605 php-src/ext/standard/string.c:1.606
--- php-src/ext/standard/string.c:1.605 Thu Oct  5 22:40:38 2006
+++ php-src/ext/standard/string.c   Thu Oct  5 22:44:31 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.605 2006/10/05 22:40:38 andrei Exp $ */
+/* $Id: string.c,v 1.606 2006/10/05 22:44:31 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -5220,6 +5220,9 @@
 /* }}} */
 
 /* {{{ php_u_str_to_str_case_ex */
+/* TODO 
+ *  - optimize for cases where pat_len = str_len
+ */
 PHPAPI UChar *php_u_str_to_str_case_ex(UChar *str, int str_len,
UChar *pat, int pat_len, UChar *repl, int repl_len, int *result_len, 
int *replace_count TSRMLS_DC)
 {

-- 
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-10-04 Thread Antony Dovgal
tony2001Wed Oct  4 10:52:33 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  return false on invalid mode and don't segfault
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.600r2=1.601diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.600 php-src/ext/standard/string.c:1.601
--- php-src/ext/standard/string.c:1.600 Tue Oct  3 18:13:36 2006
+++ php-src/ext/standard/string.c   Wed Oct  4 10:52:32 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.600 2006/10/03 18:13:36 andrei Exp $ */
+/* $Id: string.c,v 1.601 2006/10/04 10:52:32 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6465,6 +6465,7 @@
}
if (UG(unicode)  mode != 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Only 
mode=1 is supported with Unicode strings);
+   RETURN_FALSE;
}
}
 

-- 
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-10-04 Thread Andrei Zmievski
andrei  Wed Oct  4 17:38:09 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - Mark stristr() with U.
  - zpp support for ucwords()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.603r2=1.604diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.603 php-src/ext/standard/string.c:1.604
--- php-src/ext/standard/string.c:1.603 Wed Oct  4 17:25:12 2006
+++ php-src/ext/standard/string.c   Wed Oct  4 17:38:09 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.603 2006/10/04 17:25:12 andrei Exp $ */
+/* $Id: string.c,v 1.604 2006/10/04 17:38:09 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -107,7 +107,7 @@
 /* }}} */
 
 int php_tag_find(char *tag, int len, char *set);
-static void php_ucwords(zval *str);
+static void php_ucwords(char *str, int str_len);
 static UChar* php_u_strtr_array(UChar *str, int slen, HashTable *hash, int 
minlen, int maxlen, int *outlen TSRMLS_DC);
 
 /* this is read-only, so it's ok */
@@ -1681,7 +1681,7 @@
}
} else {
RETVAL_STRINGL(str.s, str_len, 1);
-   php_ucwords(return_value);
+   php_ucwords(Z_STRVAL_P(return_value), str_len);
}
 }
 /* }}} */
@@ -2337,7 +2337,7 @@
 }
 /* }}} */
 
-/* {{{ proto string stristr(string haystack, string needle[, bool part])
+/* {{{ proto string stristr(string haystack, string needle[, bool part]) U
Finds first occurrence of a string within another, case insensitive */
 PHP_FUNCTION(stristr)
 {
@@ -3695,13 +3695,13 @@
 
 /* {{{ php_ucwords()
Uppercase the first character of every word in a native string */
-static void php_ucwords(zval *str)
+static void php_ucwords(char *str, int str_len)
 {
register char *r, *r_end;
 
-   r = Z_STRVAL_P(str);
+   r = str;
*r = toupper((unsigned char) *r);
-   for (r_end = r + Z_STRLEN_P(str) - 1; r  r_end; ) {
+   for (r_end = r + str_len - 1; r  r_end; ) {
if (isspace((int) *(unsigned char *)r++)) {
*r = toupper((unsigned char) *r);
}
@@ -3711,7 +3711,7 @@
 
 /* {{{ php_u_ucwords() U
Uppercase the first character of every word in an Unicode string */
-static void php_u_ucwords(zval *ustr, zval *retval TSRMLS_DC)
+static void php_u_ucwords(UChar *ustr, int ustr_len, zval *retval TSRMLS_DC)
 {
UChar32 cp = 0;
UChar *tmp;
@@ -3726,19 +3726,19 @@
 * more than half of the codepoints in the string can follow a 
whitespace
 * and that maximum expansion is 2 UChar's.
 */
-   retval_len = ((3 * Z_USTRLEN_P(ustr))  1) + 2;
+   retval_len = ((3 * ustr_len)  1) + 2;
tmp = eumalloc(retval_len);
 
-   while (pos  Z_USTRLEN_P(ustr)) {
+   while (pos  ustr_len) {
 
-   U16_NEXT(Z_USTRVAL_P(ustr), pos, Z_USTRLEN_P(ustr), cp);
+   U16_NEXT(ustr, pos, ustr_len, cp);
 
if (u_isWhitespace(cp) == TRUE) {
tmp_len += zend_codepoint_to_uchar(cp, tmp + tmp_len);
last_was_space = TRUE;
} else {
if (last_was_space) {
-   tmp_len += u_strToUpper(tmp + tmp_len, 
retval_len - tmp_len, Z_USTRVAL_P(ustr) + last_pos, 1, UG(default_locale), 
status);
+   tmp_len += u_strToUpper(tmp + tmp_len, 
retval_len - tmp_len, ustr + last_pos, 1, UG(default_locale), status);
last_was_space = FALSE;
} else {
tmp_len += zend_codepoint_to_uchar(cp, tmp + 
tmp_len);
@@ -3762,32 +3762,32 @@
 }
 /* }}} */
 
-/* {{{ proto string ucwords(string str)
+/* {{{ proto string ucwords(string str) U
Uppercase the first character of every word in a string */
 PHP_FUNCTION(ucwords)
 {
-   zval **str;
-
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, str) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
-   }
+   zstr str;
+   int str_len;
+   zend_uchar str_type;
 
-   if (Z_TYPE_PP(str) != IS_UNICODE  Z_TYPE_PP(str) != IS_STRING) {
-   convert_to_text_ex(str);
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, str, 
str_len, str_type) == FAILURE) {
+   return;
}
 
-   if (Z_TYPE_PP(str) == IS_UNICODE  !Z_USTRLEN_PP(str)) {
-   RETURN_EMPTY_UNICODE();
-   } else if (!Z_STRLEN_PP(str)) {
-   RETURN_EMPTY_STRING();
+   if (str_len == 0) {
+   if (str_type == IS_UNICODE) {
+   RETURN_EMPTY_UNICODE();
+   } else {
+   RETURN_EMPTY_STRING();
+   }
}
 
-   if (Z_TYPE_PP(str) == IS_UNICODE) {
+   if (str_type == IS_UNICODE) {

[PHP-CVS] cvs: php-src /ext/standard string.c /ext/standard/tests/strings bug39032.phpt

2006-10-04 Thread Antony Dovgal
tony2001Wed Oct  4 11:12:21 2006 UTC

  Added files: 
/php-src/ext/standard/tests/strings bug39032.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix #39032 (strcspn() stops on null character)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.601r2=1.602diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.601 php-src/ext/standard/string.c:1.602
--- php-src/ext/standard/string.c:1.601 Wed Oct  4 10:52:32 2006
+++ php-src/ext/standard/string.c   Wed Oct  4 11:12:21 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.601 2006/10/04 10:52:32 tony2001 Exp $ */
+/* $Id: string.c,v 1.602 2006/10/04 11:12:21 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2306,11 +2306,12 @@
int codepts;
UChar32 ch;
 
-   for (i = 0, codepts = 0 ; i  len1 ; codepts++) {
+   for (i = 0, codepts = 0 ; i  len1 ; ) {
U16_NEXT(s1, i, len1, ch);
-   if (u_memchr32(s2, ch, len2)) {
+   if (!len2 || u_memchr32(s2, ch, len2)) {
break;
}
+   codepts++;
}
return codepts;
 }
@@ -2329,7 +2330,7 @@
if (*spanp == c || p == s1_end) {
return p - s1;
}
-   } while (spanp++  s2_end);
+   } while (spanp++  (s2_end - 1));
c = *++p;
}
/* NOTREACHED */

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug39032.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug39032.phpt
+++ php-src/ext/standard/tests/strings/bug39032.phpt
--TEST--
Bug #39032 (strcspn() stops on null character)
--FILE--
?php

var_dump(strcspn(chr(0),x));
var_dump(strcspn(chr(0),));
var_dump(strcspn(chr(0),qweqwe));
var_dump(strcspn(chr(1),qweqwe));

echo Done\n;
?
--EXPECTF-- 
int(1)
int(0)
int(1)
int(1)
Done

-- 
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-10-03 Thread Antony Dovgal
tony2001Tue Oct  3 13:44:15 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix ZTS build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.597r2=1.598diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.597 php-src/ext/standard/string.c:1.598
--- php-src/ext/standard/string.c:1.597 Mon Oct  2 19:18:14 2006
+++ php-src/ext/standard/string.c   Tue Oct  3 13:44:14 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.597 2006/10/02 19:18:14 andrei Exp $ */
+/* $Id: string.c,v 1.598 2006/10/03 13:44:14 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6379,7 +6379,7 @@
char retstr[256];
int retlen=0;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS(), t|l, input, input_len,
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|l, input, 
input_len,
  type, mode) == 
FAILURE) {
return;
}

-- 
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-09-29 Thread Andrei Zmievski
andrei  Fri Sep 29 21:00:08 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Heck, might as well commit this..
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.593r2=1.594diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.593 php-src/ext/standard/string.c:1.594
--- php-src/ext/standard/string.c:1.593 Sat Sep 23 12:22:07 2006
+++ php-src/ext/standard/string.c   Fri Sep 29 21:00:07 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.593 2006/09/23 12:22:07 tony2001 Exp $ */
+/* $Id: string.c,v 1.594 2006/09/29 21:00:07 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2156,6 +2156,42 @@
 
 /* {{{ php_u_stristr
Unicode version of case insensitve strstr */
+PHPAPI UChar *php_u_stristr(UChar *str, UChar *pat, int str_len, int pat_len)
+{
+   UChar *str_fold, *pat_fold;
+   int str_fold_len, pat_fold_len;
+   UChar *result, *found;
+   int offset;
+   UErrorCode status = U_ZERO_ERROR;
+
+   zend_case_fold_string(str_fold, str_fold_len, str, str_len, 
U_FOLD_CASE_DEFAULT, status);
+   if (str_fold_len == str_len) {
+   zend_case_fold_string(pat_fold, pat_fold_len, pat, pat_len, 
U_FOLD_CASE_DEFAULT, status);
+   found = u_strFindFirst(str_fold, str_fold_len, pat_fold, 
pat_fold_len);
+   if (found) {
+   result = str + (found - str_fold);
+   } else {
+   result = NULL;
+   }
+   efree(pat_fold);
+   } else {
+   usearch_setText(UG(root_search), str, str_len, status);
+   usearch_setPattern(UG(root_search), pat, pat_len, status);
+   usearch_setOffset(UG(root_search), 0, status);
+
+   offset = usearch_first(UG(root_search), status);
+   if (offset != USEARCH_DONE) {
+   result = str + offset;
+   } else {
+   result = NULL;
+   }
+   }
+   efree(str_fold);
+
+   return result;
+}
+
+#if 0
 PHPAPI UChar *php_u_stristr(UChar *s, UChar *t, int s_len, int t_len)
 {
int32_t i,j, last;
@@ -2201,6 +2237,7 @@
}
return NULL;
 }
+#endif
 /* }}} */
 
 /* {{{ php_stristr

-- 
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-09-23 Thread Antony Dovgal
tony2001Sat Sep 23 12:22:07 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  one more try to fix ZTS build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.592r2=1.593diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.592 php-src/ext/standard/string.c:1.593
--- php-src/ext/standard/string.c:1.592 Sat Sep 23 12:17:43 2006
+++ php-src/ext/standard/string.c   Sat Sep 23 12:22:07 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.592 2006/09/23 12:17:43 tony2001 Exp $ */
+/* $Id: string.c,v 1.593 2006/09/23 12:22:07 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -3418,7 +3418,7 @@
UChar cp;
zend_uchar type;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_DC, t, old, 
old_len, type) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t, old, 
old_len, type) == FAILURE) {
return;
}
 
@@ -5546,7 +5546,7 @@
}
 
if (UG(unicode)) {
-   php_error_docref(NULL TSRMLS_DC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
+   php_error_docref(NULL TSRMLS_CC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
}
 
 #ifdef HAVE_SETLOCALE
@@ -6358,7 +6358,7 @@
RETURN_FALSE;
}
if (UG(unicode)  mode != 1) {
-   php_error_docref(NULL TSRMLS_DC, E_WARNING, Only 
mode=1 is supported with Unicode strings);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Only 
mode=1 is supported with Unicode strings);
}
}
 
@@ -6483,7 +6483,7 @@
}
 
if (UG(unicode)) {
-   php_error_docref(NULL TSRMLS_DC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
+   php_error_docref(NULL TSRMLS_CC, E_STRICT, deprecated in 
Unicode mode, please use ICU locale functions);
}
 
MAKE_STD_ZVAL(grouping);

-- 
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-08-31 Thread Antony Dovgal
tony2001Thu Aug 31 14:19:33 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  more z/Z fixes
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.585r2=1.586diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.585 php-src/ext/standard/string.c:1.586
--- php-src/ext/standard/string.c:1.585 Wed Aug 30 20:24:32 2006
+++ php-src/ext/standard/string.c   Thu Aug 31 14:19:33 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.585 2006/08/30 20:24:32 tony2001 Exp $ */
+/* $Id: string.c,v 1.586 2006/08/31 14:19:33 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2292,7 +2292,7 @@
Finds first occurrence of a string within another, case insensitive */
 PHP_FUNCTION(stristr)
 {
-   zval *haystack, *needle;
+   zval **haystack, **needle;
zend_bool part = 0;
zend_uchar str_type;
char needle_char[2];
@@ -2304,83 +2304,83 @@
int found_offset;
void *start, *end;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz|b, haystack, 
needle, part) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ZZ|b, haystack, 
needle, part) == FAILURE) {
return;
}
 
-   if (Z_TYPE_P(haystack) != IS_UNICODE  Z_TYPE_P(haystack) != 
IS_STRING) {
-   convert_to_text(haystack);
+   if (Z_TYPE_PP(haystack) != IS_UNICODE  Z_TYPE_PP(haystack) != 
IS_STRING) {
+   convert_to_text_ex(haystack);
}
 
-   if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) {
-   if (!Z_UNILEN_P(needle)) {
+   if (Z_TYPE_PP(needle) == IS_UNICODE || Z_TYPE_PP(needle) == IS_STRING) {
+   if (!Z_UNILEN_PP(needle)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty 
delimiter.);
RETURN_FALSE;
}
-   if (Z_TYPE_P(haystack) != Z_TYPE_P(needle)) {
-   str_type = zend_get_unified_string_type(2 TSRMLS_CC, 
Z_TYPE_P(haystack), Z_TYPE_P(needle));
+   if (Z_TYPE_PP(haystack) != Z_TYPE_PP(needle)) {
+   str_type = zend_get_unified_string_type(2 TSRMLS_CC, 
Z_TYPE_PP(haystack), Z_TYPE_PP(needle));
if (str_type == (zend_uchar)-1) {
zend_error(E_WARNING, Cannot mix binary and 
Unicode parameters);
return;
}
-   convert_to_explicit_type(haystack, str_type);
-   convert_to_explicit_type(needle, str_type);
+   convert_to_explicit_type_ex(haystack, str_type);
+   convert_to_explicit_type_ex(needle, str_type);
}
-   target = Z_UNIVAL_P(needle);
-   needle_len = Z_UNILEN_P(needle);
+   target = Z_UNIVAL_PP(needle);
+   needle_len = Z_UNILEN_PP(needle);
} else {
-   convert_to_long_ex(needle);
+   convert_to_long_ex(needle);
needle_len = 0;
-   if (Z_TYPE_P(haystack) == IS_UNICODE) {
-   if (Z_LVAL_P(needle)  0 || Z_LVAL_P(needle)  
0x10) {
+   if (Z_TYPE_PP(haystack) == IS_UNICODE) {
+   if (Z_LVAL_PP(needle)  0 || Z_LVAL_PP(needle)  
0x10) {
php_error(E_WARNING, Needle argument codepoint 
value out of range (0 - 0x10));
RETURN_FALSE;
}
-   if (U_IS_BMP(Z_LVAL_P(needle))) {
-   u_needle_char[needle_len++] = 
(UChar)Z_LVAL_P(needle);
+   if (U_IS_BMP(Z_LVAL_PP(needle))) {
+   u_needle_char[needle_len++] = 
(UChar)Z_LVAL_PP(needle);
u_needle_char[needle_len]   = 0;
} else {
-   u_needle_char[needle_len++] = 
(UChar)U16_LEAD(Z_LVAL_P(needle));
-   u_needle_char[needle_len++] = 
(UChar)U16_TRAIL(Z_LVAL_P(needle));
+   u_needle_char[needle_len++] = 
(UChar)U16_LEAD(Z_LVAL_PP(needle));
+   u_needle_char[needle_len++] = 
(UChar)U16_TRAIL(Z_LVAL_PP(needle));
u_needle_char[needle_len]   = 0;
}
target.u = u_needle_char;
} else {
-   needle_char[needle_len++] = (char)Z_LVAL_P(needle);
+   needle_char[needle_len++] = (char)Z_LVAL_PP(needle);
needle_char[needle_len] = 0;
target.s = needle_char;
}
}
 
-   if (needle_len  

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

2006-08-31 Thread Andrei Zmievski
It's cool that you fixed it, but all that is going to change when the 
functions are upgraded..


-Andrei

On Aug 31, 2006, at 7:19 AM, Antony Dovgal wrote:


tony2001Thu Aug 31 14:19:33 2006 UTC

  Modified files:
/php-src/ext/standard   string.c
  Log:
  more z/Z fixes

tony2001-20060831141933.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



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

2006-08-31 Thread Antony Dovgal

On 31.08.2006 19:56, Andrei Zmievski wrote:
It's cool that you fixed it, but all that is going to change when the 
functions are upgraded..


I thought they are already Unicode aware, aren't they?

--
Wbr, 
Antony Dovgal


--
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 string.c

2006-08-31 Thread Andrei Zmievski

No, check out unicode-progress.txt.

-Andrei

On Aug 31, 2006, at 8:56 AM, Andrei Zmievski wrote:

It's cool that you fixed it, but all that is going to change when the 
functions are upgraded..


-Andrei

On Aug 31, 2006, at 7:19 AM, Antony Dovgal wrote:


tony2001Thu Aug 31 14:19:33 2006 UTC

  Modified files:
/php-src/ext/standard   string.c
  Log:
  more z/Z fixes

tony2001-20060831141933.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 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-08-30 Thread Antony Dovgal
tony2001Wed Aug 30 20:24:32 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix ZTS build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.584r2=1.585diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.584 php-src/ext/standard/string.c:1.585
--- php-src/ext/standard/string.c:1.584 Wed Aug 30 18:40:26 2006
+++ php-src/ext/standard/string.c   Wed Aug 30 20:24:32 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.584 2006/08/30 18:40:26 iliaa Exp $ */
+/* $Id: string.c,v 1.585 2006/08/30 20:24:32 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1294,7 +1294,7 @@
}
}
 
-   php_implode(delim, arr, return_value TSRMLS_DC);
+   php_implode(delim, arr, return_value TSRMLS_CC);
 
if (argc == 1) {
FREE_ZVAL(delim);

-- 
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-08-21 Thread Dmitry Stogov
dmitry  Tue Aug 22 04:54:00 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  ZTS fix
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.582r2=1.583diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.582 php-src/ext/standard/string.c:1.583
--- php-src/ext/standard/string.c:1.582 Fri Aug 18 18:01:58 2006
+++ php-src/ext/standard/string.c   Tue Aug 22 04:54:00 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.582 2006/08/18 18:01:58 andrei Exp $ */
+/* $Id: string.c,v 1.583 2006/08/22 04:54:00 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6938,7 +6938,7 @@
 /* }}} */
 
 /* {{{ php_str_word_count */
-static int php_str_word_count(char *str, int str_len, long type, char 
*char_list, int char_list_len, zval *return_value)
+static int php_str_word_count(char *str, int str_len, long type, char 
*char_list, int char_list_len, zval *return_value TSRMLS_DC)
 {
char ch[256], *p, *e, *s, *buf;
int word_count = 0;
@@ -7017,7 +7017,7 @@
if (str_type == IS_UNICODE) {
word_count = php_u_str_word_count(str.u, str_len, type, 
char_list.u, char_list_len, return_value TSRMLS_CC);
} else {
-   word_count = php_str_word_count(str.s, str_len, type, 
char_list.s, char_list_len, return_value);
+   word_count = php_str_word_count(str.s, str_len, type, 
char_list.s, char_list_len, return_value TSRMLS_CC);
}
 
if (!type) {

-- 
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-08-16 Thread Andrei Zmievski
andrei  Wed Aug 16 18:07:22 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Simplify php_u_trim().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.580r2=1.581diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.580 php-src/ext/standard/string.c:1.581
--- php-src/ext/standard/string.c:1.580 Tue Aug 15 20:38:12 2006
+++ php-src/ext/standard/string.c   Wed Aug 16 18:07:22 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.580 2006/08/15 20:38:12 andrei Exp $ */
+/* $Id: string.c,v 1.581 2006/08/16 18:07:22 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -709,10 +709,6 @@
UChar   ch = 0, wh = 0;
int32_t start = 0, end = len;
 
-   /*
-* UTODO
-* fix trim(a) results in 
-*/
if ( what ) {
what = eustrndup(what, what_len);
php_expand_u_trim_range(what, what_len TSRMLS_CC);
@@ -722,11 +718,9 @@
for ( i = k = 0 ; i  end ; ) {
U16_NEXT(c, k, end, ch);
if ( what ) {
-   for ( j = 0 ; j  what_len ;  ) {
-   U16_NEXT(what, j, what_len, wh);
-   if ( wh == ch ) break;
+   if (u_memchr32(what, ch, what_len) == NULL) {
+   break;
}
-   if ( wh != ch ) break;
} else {
if ( u_isWhitespace(ch) == FALSE ) {
break;
@@ -740,11 +734,9 @@
for ( i = k = end ; i  start ; ) {
U16_PREV(c, 0, k, ch);
if ( what ) {
-   for ( j = 0 ; j  what_len ; ) {
-   U16_NEXT(what, j, what_len, wh);
-   if ( wh == ch ) break;
+   if (u_memchr32(what, ch, what_len) == NULL) {
+   break;
}
-   if ( wh != ch ) break;
} else {
if ( u_isWhitespace(ch) == 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/standard string.c

2006-08-14 Thread Edin Kadribasic
edink   Mon Aug 14 11:59:07 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fixed windows build.
  Looking at the macro definition it seems that the second argument
  to U_STRING_DECL can only be a string literal, not an indetifier.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.575r2=1.576diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.575 php-src/ext/standard/string.c:1.576
--- php-src/ext/standard/string.c:1.575 Thu Aug 10 19:02:32 2006
+++ php-src/ext/standard/string.c   Mon Aug 14 11:59:07 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.575 2006/08/10 19:02:32 iliaa Exp $ */
+/* $Id: string.c,v 1.576 2006/08/14 11:59:07 edink Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6777,8 +6777,9 @@
 
 static char rot13_from[] = 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ;
 static char rot13_to[] = 
nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM;
-U_STRING_DECL(u_rot13_from, rot13_from, sizeof(rot13_from)-1);
-U_STRING_DECL(u_rot13_to, rot13_to, sizeof(rot13_to)-1);
+U_STRING_DECL(u_rot13_from, 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ, sizeof(rot13_from)-1);
+U_STRING_DECL(u_rot13_to, 
nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM, sizeof(rot13_to)-1);
+
 
 /* {{{ proto string str_rot13(string str) U
Perform the rot13 transform on a string */

-- 
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-08-10 Thread Antony Dovgal
tony2001Thu Aug 10 09:31:25 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  initialize variable
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.573r2=1.574diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.573 php-src/ext/standard/string.c:1.574
--- php-src/ext/standard/string.c:1.573 Wed Aug  9 20:31:06 2006
+++ php-src/ext/standard/string.c   Thu Aug 10 09:31:24 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.573 2006/08/09 20:31:06 tony2001 Exp $ */
+/* $Id: string.c,v 1.574 2006/08/10 09:31:24 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2101,7 +2101,7 @@
 
if (have_ext) {
zstr ext;
-   int ext_len;
+   int ext_len = 0;
 
if (path_type == IS_UNICODE) {
ext.u = u_memrchr32(ret.u, (UChar) 0x2e /*'.'*/, 
ret_len);

-- 
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-08-09 Thread Frank M. Kromann
fmk Wed Aug  9 18:15:06 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Fix ZTS builds
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.569r2=1.570diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.569 php-src/ext/standard/string.c:1.570
--- php-src/ext/standard/string.c:1.569 Wed Aug  9 17:40:21 2006
+++ php-src/ext/standard/string.c   Wed Aug  9 18:15:06 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.569 2006/08/09 17:40:21 andrei Exp $ */
+/* $Id: string.c,v 1.570 2006/08/09 18:15:06 fmk Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4367,7 +4367,7 @@
char *str, *what;
int str_len, what_len;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_DC, SS, str, 
str_len,
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, SS, str, 
str_len,
  what, what_len) == 
FAILURE) {
return;
}
@@ -4423,7 +4423,7 @@
char *str;
int str_len;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_DC, S, str, 
str_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S, str, 
str_len) == FAILURE) {
return;
}
 

-- 
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-08-09 Thread Antony Dovgal
tony2001Wed Aug  9 20:31:06 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix ZTS build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.572r2=1.573diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.572 php-src/ext/standard/string.c:1.573
--- php-src/ext/standard/string.c:1.572 Wed Aug  9 20:19:06 2006
+++ php-src/ext/standard/string.c   Wed Aug  9 20:31:06 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.572 2006/08/09 20:19:06 andrei Exp $ */
+/* $Id: string.c,v 1.573 2006/08/09 20:31:06 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6812,7 +6812,7 @@
 
if (str_type == IS_UNICODE) {
RETVAL_UNICODEL(str.u, str_len, 0);
-   Z_USTRVAL_P(return_value) = 
php_u_strtr(Z_USTRVAL_P(return_value), Z_USTRLEN_P(return_value), u_rot13_from, 
52, u_rot13_to, 52, 52, Z_USTRLEN_P(return_value));
+   Z_USTRVAL_P(return_value) = 
php_u_strtr(Z_USTRVAL_P(return_value), Z_USTRLEN_P(return_value), u_rot13_from, 
52, u_rot13_to, 52, 52, Z_USTRLEN_P(return_value) TSRMLS_CC);
} else {
RETVAL_STRINGL(str.s, str_len, 1);
php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 
rot13_from, rot13_to, 52);

-- 
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-08-08 Thread Antony Dovgal
tony2001Tue Aug  8 08:59:52 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix typo and invalid read
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.564r2=1.565diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.564 php-src/ext/standard/string.c:1.565
--- php-src/ext/standard/string.c:1.564 Fri Aug  4 23:20:04 2006
+++ php-src/ext/standard/string.c   Tue Aug  8 08:59:51 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.564 2006/08/04 23:20:04 andrei Exp $ */
+/* $Id: string.c,v 1.565 2006/08/08 08:59:51 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2688,7 +2688,7 @@
u_needle_char[needle_len++] = U16_TRAIL(ch);
u_needle_char[needle_len]   = 0;
}
-   haystack_dup = php_u_strtolower(haystack_dup, 
haystack_len, UG(default_locale));
+   haystack_dup = php_u_strtolower(Z_USTRVAL_P(haystack), 
haystack_len, UG(default_locale));
found = zend_u_memnstr((UChar *)haystack_dup + offset,
   (UChar 
*)u_needle_char, needle_len,
   (UChar 
*)haystack_dup + haystack_len);

-- 
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 /ext/standard/tests/strings strings001.phpt

2006-08-08 Thread Antony Dovgal
tony2001Tue Aug  8 09:48:08 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings strings001.phpt 
  Log:
  use memrchr/zend_memrchr instead of strrchr
  fix wrong test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.565r2=1.566diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.565 php-src/ext/standard/string.c:1.566
--- php-src/ext/standard/string.c:1.565 Tue Aug  8 08:59:51 2006
+++ php-src/ext/standard/string.c   Tue Aug  8 09:48:08 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.565 2006/08/08 08:59:51 tony2001 Exp $ */
+/* $Id: string.c,v 1.566 2006/08/08 09:48:08 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2104,13 +2104,13 @@
int ext_len;
 
if (path_type == IS_UNICODE) {
-   ext.u = u_strrchr(ret.u, (UChar) 0x2e /*'.'*/);
+   ext.u = u_memrchr32(ret.u, (UChar) 0x2e /*'.'*/, 
ret_len);
if (ext.u) {
ext.u++;
ext_len = ret_len - (ext.u - ret.u);
}
} else {
-   ext.s = strrchr(ret.s, '.');
+   ext.s = zend_memrchr(ret.s, '.', ret_len);
if (ext.s) {
ext.s++;
ext_len = ret_len - (ext.s - ret.s);
@@ -2127,10 +2127,10 @@
int idx;
 
if (path_type == IS_UNICODE) {
-   p.u = u_strrchr(ret.u, (UChar) 0x2e /*'.'*/);
+   p.u = u_memrchr32(ret.u, (UChar) 0x2e /*'.'*/, ret_len);
idx = p.u ? (p.u - ret.u) : ret_len;
} else {
-   p.s = strrchr(ret.s, '.');
+   p.s = zend_memrchr(ret.s, '.', ret_len);
idx = p.s ? (p.s - ret.s) : ret_len;
}
 
@@ -2961,7 +2961,7 @@
ch = zend_get_codepoint_at(Z_USTRVAL_P(needle), 
Z_USTRLEN_P(needle), 0);
found = u_memrchr32(Z_USTRVAL_P(haystack), ch, 
Z_USTRLEN_P(haystack));
} else {
-   found = strrchr(Z_STRVAL_P(haystack), 
*Z_STRVAL_P(needle));
+   found = zend_memrchr(Z_STRVAL_P(haystack), 
*Z_STRVAL_P(needle), Z_STRLEN_P(haystack));
}
} else {
convert_to_long(needle);
@@ -2973,7 +2973,7 @@
}
found = u_memrchr32(Z_USTRVAL_P(haystack), ch, 
Z_USTRLEN_P(haystack));
} else {
-   found = strrchr(Z_STRVAL_P(haystack), 
(char)Z_LVAL_P(needle));
+   found = zend_memrchr(Z_STRVAL_P(haystack), 
(char)Z_LVAL_P(needle), Z_STRLEN_P(haystack));
}
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strings001.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/standard/tests/strings/strings001.phpt
diff -u php-src/ext/standard/tests/strings/strings001.phpt:1.2 
php-src/ext/standard/tests/strings/strings001.phpt:1.3
--- php-src/ext/standard/tests/strings/strings001.phpt:1.2  Sat Oct 26 
20:07:49 2002
+++ php-src/ext/standard/tests/strings/strings001.phpt  Tue Aug  8 09:48:08 2006
@@ -9,4 +9,7 @@
 ?
 --EXPECTREGEX--
 string\(18\) \nica\x00turska panica\
-string\(19\) \ nica\x00turska panica\
+string\(7\) \ panica\
+--UEXPECTREGEX--
+unicode\(18\) \nica\x00turska panica\
+unicode\(7\) \ panica\

-- 
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-08-08 Thread Antony Dovgal
tony2001Tue Aug  8 22:01:48 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  initialize vars
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.567r2=1.568diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.567 php-src/ext/standard/string.c:1.568
--- php-src/ext/standard/string.c:1.567 Tue Aug  8 21:03:11 2006
+++ php-src/ext/standard/string.c   Tue Aug  8 22:01:48 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.567 2006/08/08 21:03:11 andrei Exp $ */
+/* $Id: string.c,v 1.568 2006/08/08 22:01:48 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -698,7 +698,7 @@
 static UChar *php_u_trim(UChar *c, int len, UChar *what, int what_len, zval 
*return_value, int mode TSRMLS_DC)
 {
int32_t i,j;
-   UChar   ch,wh;
+   UChar   ch = 0, wh = 0;
int32_t start = 0, end = len;
 
/*

-- 
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-08-04 Thread Andrei Zmievski
andrei  Fri Aug  4 23:20:04 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Simplify strrchr().
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.563r2=1.564diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.563 php-src/ext/standard/string.c:1.564
--- php-src/ext/standard/string.c:1.563 Fri Aug  4 21:06:11 2006
+++ php-src/ext/standard/string.c   Fri Aug  4 23:20:04 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.563 2006/08/04 21:06:11 andrei Exp $ */
+/* $Id: string.c,v 1.564 2006/08/04 23:20:04 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2931,23 +2931,6 @@
 }
 /* }}} */
 
-/* {{{ php_u_strrchr
- */
-UChar *php_u_strrchr(UChar *s, UChar32 ch, int s_len)
-{
-   UChar32 ch1;
-   int32_t i = s_len;
-
-   while (i  0) {
-   U16_PREV(s, 0, i, ch1);
-   if (ch1 == ch) {
-   return (s+i);
-   }
-   }
-   return NULL;
-}
-/* }}} */
-
 /* {{{ proto string strrchr(string haystack, string needle) U
Finds the last occurrence of a character in a string within another */
 PHP_FUNCTION(strrchr)
@@ -2958,37 +2941,37 @@
void *found = NULL;
int found_offset;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_parse_parameters(2 TSRMLS_CC, zz, 
haystack, needle) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z/z/, haystack, 
needle) == FAILURE) {
+   return;
}
if (Z_TYPE_P(haystack) != IS_UNICODE || Z_TYPE_P(haystack) != 
IS_STRING) {
-   convert_to_string(haystack);
+   convert_to_text(haystack);
}
 
if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) {
if (Z_TYPE_P(needle) != Z_TYPE_P(haystack)) {
str_type = zend_get_unified_string_type(2 TSRMLS_CC, 
Z_TYPE_P(haystack), Z_TYPE_P(needle));
-   if (str_type == (zend_uchar)-1) {
-   zend_error(E_WARNING, Cannot mix binary and 
Unicode parameters);
-   return;
-   }
convert_to_explicit_type(haystack, str_type);
convert_to_explicit_type(needle, str_type);
}
+   if (Z_USTRLEN_P(needle) == 0) {
+   RETURN_FALSE;
+   }
if (Z_TYPE_P(haystack) == IS_UNICODE) {
-   U16_GET(Z_USTRVAL_P(needle), 0, 0, Z_USTRLEN_P(needle), 
ch);
-   found = php_u_strrchr(Z_USTRVAL_P(haystack), ch, 
Z_USTRLEN_P(haystack));
+   ch = zend_get_codepoint_at(Z_USTRVAL_P(needle), 
Z_USTRLEN_P(needle), 0);
+   found = u_memrchr32(Z_USTRVAL_P(haystack), ch, 
Z_USTRLEN_P(haystack));
} else {
found = strrchr(Z_STRVAL_P(haystack), 
*Z_STRVAL_P(needle));
}
} else {
convert_to_long(needle);
if (Z_TYPE_P(haystack) == IS_UNICODE) {
-   if (Z_LVAL_P(needle)  0 || Z_LVAL_P(needle)  
0x10) {
+   UChar32 ch = (UChar32)Z_LVAL_P(needle);
+   if (ch  0 || ch  0x10) {
php_error(E_WARNING, Needle argument codepoint 
value out of range (0 - 0x10));
RETURN_FALSE;
}
-   found = php_u_strrchr(Z_USTRVAL_P(haystack), 
(UChar32)Z_LVAL_P(needle), Z_USTRLEN_P(haystack));
+   found = u_memrchr32(Z_USTRVAL_P(haystack), ch, 
Z_USTRLEN_P(haystack));
} else {
found = strrchr(Z_STRVAL_P(haystack), 
(char)Z_LVAL_P(needle));
}

-- 
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-08-03 Thread Andrei Zmievski
andrei  Thu Aug  3 23:45:27 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  Upgraded basename() to work on IS_UNICODE strings as well.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.560r2=1.561diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.560 php-src/ext/standard/string.c:1.561
--- php-src/ext/standard/string.c:1.560 Thu Aug  3 23:09:29 2006
+++ php-src/ext/standard/string.c   Thu Aug  3 23:45:27 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.560 2006/08/03 23:09:29 andrei Exp $ */
+/* $Id: string.c,v 1.561 2006/08/03 23:45:27 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1688,6 +1688,55 @@
 }
 /* }}} */
 
+/* {{{ php_u_basename
+ */
+PHPAPI void php_u_basename(UChar *s, int len, UChar *suffix, int sufflen, 
UChar **p_ret, int *p_len TSRMLS_DC)
+{
+   UChar *ret = NULL, *end, *c, *comp, *cend;
+   int state;
+
+   c = comp = cend = s;
+   end = s + len;
+   state = 0;
+   while (c  end) {
+#if defined(PHP_WIN32) || defined(NETWARE)
+   if (*c == (UChar) 0x2f /*'/'*/ || *c == (UChar) 0x5c /*'\\'*/) {
+#else
+   if (*c == (UChar) 0x2f /*'/'*/) {
+#endif
+   if (state == 1) {
+   state = 0;
+   cend = c;
+   }
+   } else {
+   if (state == 0) {
+   comp = c;
+   state = 1;
+   }
+   }
+   c++;
+   }
+
+   if (state == 1) {
+   cend = c;
+   }
+   if (suffix != NULL  sufflen  (cend - comp) 
+   u_memcmp(cend - sufflen, suffix, sufflen) == 0) {
+   cend -= sufflen;
+   }
+
+   len = cend - comp;
+   ret = eustrndup(comp, len);
+
+   if (p_ret) {
+   *p_ret = ret;
+   }
+   if (p_len) {
+   *p_len = len;
+   }
+}
+/* }}} */
+
 /* {{{ php_basename
  */
 PHPAPI void php_basename(char *s, size_t len, char *suffix, size_t sufflen, 
char **p_ret, size_t *p_len TSRMLS_DC)
@@ -1761,20 +1810,26 @@
 }
 /* }}} */
 
-/* {{{ proto string basename(string path [, string suffix])
+/* {{{ proto string basename(string path [, string suffix]) U
Returns the filename component of the path */
 PHP_FUNCTION(basename)
 {
-   char *string, *suffix = NULL, *ret;
-   int   string_len, suffix_len = 0;
-   size_t ret_len;
+   zstr string, suffix = NULL_ZSTR, ret;
+   int string_len, suffix_len = 0;
+   zend_uchar string_type, suffix_type;
+   int ret_len;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|s, string, 
string_len, suffix, suffix_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, T|T, string, 
string_len, string_type, suffix, suffix_len, suffix_type) == FAILURE) {
return;
}
 
-   php_basename(string, string_len, suffix, suffix_len, ret, ret_len 
TSRMLS_CC);
-   RETURN_STRINGL(ret, (int)ret_len, 0);
+   if (string_type == IS_UNICODE) {
+   php_u_basename(string.u, string_len, suffix.u, suffix_len, 
ret.u, ret_len TSRMLS_CC);
+   RETURN_UNICODEL(ret.u, ret_len, 0);
+   } else {
+   php_basename(string.s, string_len, suffix.s, suffix_len, 
ret.s, ret_len TSRMLS_CC);
+   RETURN_STRINGL(ret.s, ret_len, 0);
+   }
 }
 /* }}} */
 

-- 
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-08-02 Thread Andrei Zmievski
andrei  Wed Aug  2 20:38:39 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  bin2hex() should accept only binary strings.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.556r2=1.557diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.556 php-src/ext/standard/string.c:1.557
--- php-src/ext/standard/string.c:1.556 Fri Jul 28 12:21:34 2006
+++ php-src/ext/standard/string.c   Wed Aug  2 20:38:39 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.556 2006/07/28 12:21:34 tony2001 Exp $ */
+/* $Id: string.c,v 1.557 2006/08/02 20:38:39 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -195,7 +195,7 @@
char *result;
size_t newlen;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, data, 
data_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S, data, 
data_len) == FAILURE) {
return;
}
 

-- 
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-08-02 Thread Andrei Zmievski
andrei  Wed Aug  2 21:53:43 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  A few fixes noted during analysis.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.557r2=1.558diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.557 php-src/ext/standard/string.c:1.558
--- php-src/ext/standard/string.c:1.557 Wed Aug  2 20:38:39 2006
+++ php-src/ext/standard/string.c   Wed Aug  2 21:53:43 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.557 2006/08/02 20:38:39 andrei Exp $ */
+/* $Id: string.c,v 1.558 2006/08/02 21:53:43 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -205,10 +205,7 @@
RETURN_FALSE;
}
 
-   RETVAL_ASCII_STRINGL(result, newlen, 0);
-   if (UG(unicode)) {
-   efree(result);
-   }
+   RETVAL_ASCII_STRINGL(result, newlen, ZSTR_AUTOFREE);
 }
 /* }}} */
 
@@ -1108,12 +1105,8 @@
longlimit = -1;
int argc = ZEND_NUM_ARGS();
 
-   if ( argc  2 || argc  3 ) {
-   WRONG_PARAM_COUNT;
-   }
-
-   if ( zend_parse_parameters(argc TSRMLS_CC, TT|l, delim, delim_len, 
delim_type,
-  str, str_len, 
str_type, limit) == FAILURE) {
+   if (zend_parse_parameters(argc TSRMLS_CC, TT|l, delim, delim_len, 
delim_type,
+ str, str_len, 
str_type, limit) == FAILURE) {
return;
}
 
@@ -1156,7 +1149,7 @@
 }
 /* }}} */
 
-/* {{{ proto string join([string glue,] array pieces)
+/* {{{ proto string join([string glue,] array pieces) U
An alias for implode */
 /* }}} */
 
@@ -1332,9 +1325,6 @@
int delim_found, token_present;
int skipped = 0;
 
-   if (ZEND_NUM_ARGS()  1 || ZEND_NUM_ARGS()  2) {
-   WRONG_PARAM_COUNT;
-   }
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, T|T,
  str, str_len, 
str_type,
  tok, tok_len, 
tok_type) == FAILURE) {
@@ -1528,7 +1518,7 @@
 }
 /* }}} */
 
-/* {{{ proto string strtoupper(string str)
+/* {{{ proto string strtoupper(string str) U
Makes a string uppercase */
 PHP_FUNCTION(strtoupper)
 {
@@ -1597,7 +1587,7 @@
 }
 /* }}} */
 
-/* {{{ proto string strtolower(string str)
+/* {{{ proto string strtolower(string str) U
Makes a string lowercase */
 PHP_FUNCTION(strtolower)
 {
@@ -1663,7 +1653,7 @@
 /* }}} */
 
 
-/* {{{ proto string strtotitle(string str)
+/* {{{ proto string strtotitle(string str) U
Makes a string titlecase */
 PHP_FUNCTION(strtotitle)
 {
@@ -2324,7 +2314,7 @@
 }
 /* }}} */
 
-/* {{{ proto string strchr(string haystack, string needle[, bool part])
+/* {{{ proto string strchr(string haystack, string needle[, bool part]) U
An alias for strstr */
 /* }}} */
 
@@ -4085,8 +4075,7 @@
sum += php_u_similar_char(txt1, pos1, txt2, pos2);
}
if ((pos1 + end1  len1)  (pos2 + end2  len2)) {
-   /* FIXME should this be calling php_u_similar_char? */
-   sum += php_similar_char((UChar *)txt1+pos1+end1, 
len1-pos1-end1,
+   sum += php_u_similar_char((UChar *)txt1+pos1+end1, 
len1-pos1-end1,
(UChar 
*)txt2+pos2+end2, len2-pos2-end2);
}
}

-- 
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-07-28 Thread Antony Dovgal
tony2001Fri Jul 28 12:21:34 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  patch for #37846 (wordwrap() wraps incorrectly) 
  by Dmitry Kononov ddk at krasn dot ru
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.555r2=1.556diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.555 php-src/ext/standard/string.c:1.556
--- php-src/ext/standard/string.c:1.555 Mon Jul 17 20:43:07 2006
+++ php-src/ext/standard/string.c   Fri Jul 28 12:21:34 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.555 2006/07/17 20:43:07 mike Exp $ */
+/* $Id: string.c,v 1.556 2006/07/28 12:21:34 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -872,7 +872,7 @@
lastspace = current;
} else if (current - laststart = linelength  
laststart != lastspace) {
newtext[lastspace] = breakchar[0];
-   laststart = lastspace;
+   laststart = lastspace + 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 string.c /ext/standard/tests/strings pathinfo.phpt

2006-07-17 Thread Antony Dovgal
tony2001Mon Jul 17 06:44:45 2006 UTC

  Added files: 
/php-src/ext/standard/tests/strings pathinfo.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix access to freed memory in pathinfo()
  add test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.553r2=1.554diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.553 php-src/ext/standard/string.c:1.554
--- php-src/ext/standard/string.c:1.553 Sun Jul 16 15:56:00 2006
+++ php-src/ext/standard/string.c   Mon Jul 17 06:44:45 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.553 2006/07/16 15:56:00 pajoye Exp $ */
+/* $Id: string.c,v 1.554 2006/07/17 06:44:45 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1901,7 +1901,7 @@
 {
zval *tmp;
char *path, *ret = NULL;
-   int path_len;
+   int path_len, have_basename;
size_t ret_len;
long opt = PHP_PATHINFO_ALL;
 
@@ -1909,6 +1909,8 @@
return;
}
 
+   have_basename = ((opt  PHP_PATHINFO_BASENAME) == 
PHP_PATHINFO_BASENAME);
+   
MAKE_STD_ZVAL(tmp);
array_init(tmp);
 
@@ -1919,22 +1921,18 @@
add_assoc_rt_string(tmp, dirname, ret, 1);
}
efree(ret);
+   ret = NULL;
}
 
-   if ((opt  PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME) {
+   if (have_basename) {
php_basename(path, path_len, NULL, 0, ret, ret_len TSRMLS_CC);
add_assoc_rt_stringl(tmp, basename, ret, ret_len, 0);
-   if (UG(unicode)) {
-   efree(ret);
-   }
}
 
if ((opt  PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) {
char *p;
int idx;
-   int have_basename = ((opt  PHP_PATHINFO_BASENAME) == 
PHP_PATHINFO_BASENAME);
 
-   /* Have we alrady looked up the basename? */
if (!have_basename) {
php_basename(path, path_len, NULL, 0, ret, ret_len 
TSRMLS_CC);
}
@@ -1945,19 +1943,14 @@
idx = p - ret;
add_assoc_rt_stringl(tmp, extension, ret + idx + 1, 
ret_len - idx - 1, 1);
}
-
-   if (!have_basename) {
-   efree(ret);
-   }
}
 
if ((opt  PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) {
char *p;
int idx;
-   int have_basename = ((opt  PHP_PATHINFO_BASENAME) == 
PHP_PATHINFO_BASENAME);
 
/* Have we alrady looked up the basename? */
-   if (!have_basename) {
+   if (!have_basename  !ret) {
php_basename(path, path_len, NULL, 0, ret, ret_len 
TSRMLS_CC);
}
 
@@ -1965,10 +1958,10 @@
 
idx = p ? (p - ret) : ret_len;
add_assoc_stringl(tmp, filename, ret, idx, 1);
+   }
 
-   if (!have_basename) {
-   efree(ret);
-   }
+   if (!have_basename  ret) {
+   efree(ret);
}
 
if (opt == PHP_PATHINFO_ALL) {

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/pathinfo.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/pathinfo.phpt
+++ php-src/ext/standard/tests/strings/pathinfo.phpt
--TEST--
pathinfo() tests
--FILE--
?php

var_dump(pathinfo());
var_dump(pathinfo());
var_dump(pathinfo(.));
var_dump(pathinfo(..));
var_dump(pathinfo(/));
var_dump(pathinfo(./));
var_dump(pathinfo(/.));
var_dump(pathinfo(.cvsignore));
var_dump(pathinfo(__FILE__, PATHINFO_BASENAME));
var_dump(pathinfo(__FILE__, PATHINFO_FILENAME));
var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION));
var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME));
var_dump(pathinfo(__FILE__, 
PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_DIRNAME));
var_dump(pathinfo(__FILE__, 
PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_BASENAME));
var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_FILENAME));
var_dump(pathinfo(__FILE__, PATHINFO_EXTENSION|PATHINFO_BASENAME));
var_dump(pathinfo(__FILE__, PATHINFO_FILENAME|PATHINFO_DIRNAME));
var_dump(pathinfo(__FILE__, PATHINFO_FILENAME|PATHINFO_BASENAME));
var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_EXTENSION));
var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME));

echo Done\n;
?
--EXPECTF-- 
Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d
NULL
array(2) {
  [basename]=
  string(0) 
  [filename]=
  string(0) 
}
array(4) {
  [dirname]=
  string(1) .
  [basename]=
  string(1) .
  [extension]=
  string(0) 
  [filename]=
  string(0) 
}
array(4) {
  [dirname]=
  string(1) .
  [basename]=
  string(2) ..
  [extension]=
  string(0) 
  [filename]=
  

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

2006-07-17 Thread Michael Wallner
mikeMon Jul 17 20:43:07 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFB52: fix bug #37945 pathinfo() cannot handle argument with special
 characters like german Umlaute
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.554r2=1.555diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.554 php-src/ext/standard/string.c:1.555
--- php-src/ext/standard/string.c:1.554 Mon Jul 17 06:44:45 2006
+++ php-src/ext/standard/string.c   Mon Jul 17 20:43:07 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.554 2006/07/17 06:44:45 tony2001 Exp $ */
+/* $Id: string.c,v 1.555 2006/07/17 20:43:07 mike Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1730,7 +1730,12 @@
state = 1;
}
}
+   break;
default:
+   if (state == 0) {
+   comp = c;
+   state = 1;
+   }
break;
}
c += inc_len;

-- 
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 /ext/standard/tests/strings bug24098.phpt

2006-07-16 Thread Marcus Boerger
helly   Sun Jul 16 10:34:32 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings bug24098.phpt 
  Log:
  - Pathinfo allows to get filename (Toby S, Christian S)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.551r2=1.552diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.551 php-src/ext/standard/string.c:1.552
--- php-src/ext/standard/string.c:1.551 Thu Jul 13 22:26:50 2006
+++ php-src/ext/standard/string.c   Sun Jul 16 10:34:31 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.551 2006/07/13 22:26:50 andrei Exp $ */
+/* $Id: string.c,v 1.552 2006/07/16 10:34:31 helly Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -62,7 +62,8 @@
 #define PHP_PATHINFO_DIRNAME   1
 #define PHP_PATHINFO_BASENAME  2
 #define PHP_PATHINFO_EXTENSION 4
-#define PHP_PATHINFO_ALL   (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | 
PHP_PATHINFO_EXTENSION)
+#define PHP_PATHINFO_FILENAME  8
+#define PHP_PATHINFO_ALL   (PHP_PATHINFO_DIRNAME | PHP_PATHINFO_BASENAME | 
PHP_PATHINFO_EXTENSION | PHP_PATHINFO_FILENAME)
 
 #define STR_STRSPN 0
 #define STR_STRCSPN1
@@ -1948,6 +1949,26 @@
efree(ret);
}
}
+   
+   if ((opt  PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) {
+   char *p;
+   int idx;
+   int have_basename = ((opt  PHP_PATHINFO_BASENAME) == 
PHP_PATHINFO_BASENAME);
+
+   /* Have we alrady looked up the basename? */
+   if (!have_basename) {
+   php_basename(path, path_len, NULL, 0, ret, ret_len 
TSRMLS_CC);
+   }
+
+   p = strrchr(ret, '.');
+
+   idx = p ? (p - ret) : ret_len;
+   add_assoc_stringl(tmp, filename, ret, idx, 1);
+
+   if (!have_basename) {
+   efree(ret);
+   }
+   }
 
if (opt == PHP_PATHINFO_ALL) {
RETURN_ZVAL(tmp, 0, 1);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug24098.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/strings/bug24098.phpt
diff -u php-src/ext/standard/tests/strings/bug24098.phpt:1.3 
php-src/ext/standard/tests/strings/bug24098.phpt:1.4
--- php-src/ext/standard/tests/strings/bug24098.phpt:1.3Tue Aug 23 
12:53:30 2005
+++ php-src/ext/standard/tests/strings/bug24098.phptSun Jul 16 10:34:32 2006
@@ -14,6 +14,8 @@
   string(8) dsds.asa
   [extension]=
   string(3) asa
+  [filename]=
+  string(4) dsds
 }
 --UEXPECT--
 array(3) {
@@ -23,4 +25,6 @@
   unicode(8) dsds.asa
   [uextension]=
   unicode(3) asa
+  [ufilename]=
+  string(4) dsds
 }

-- 
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-07-16 Thread Pierre-Alain Joye
pajoye  Sun Jul 16 15:56:00 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - MFB: PATHINFO_FILENAME constant registration (Sara)
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.552r2=1.553diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.552 php-src/ext/standard/string.c:1.553
--- php-src/ext/standard/string.c:1.552 Sun Jul 16 10:34:31 2006
+++ php-src/ext/standard/string.c   Sun Jul 16 15:56:00 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.552 2006/07/16 10:34:31 helly Exp $ */
+/* $Id: string.c,v 1.553 2006/07/16 15:56:00 pajoye Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -78,9 +78,10 @@
REGISTER_LONG_CONSTANT(PATHINFO_DIRNAME, PHP_PATHINFO_DIRNAME, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PATHINFO_BASENAME, PHP_PATHINFO_BASENAME, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PATHINFO_EXTENSION, PHP_PATHINFO_EXTENSION, 
CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(PATHINFO_FILENAME, PHP_PATHINFO_FILENAME, 
CONST_CS | CONST_PERSISTENT);
 
 #ifdef HAVE_LOCALECONV
-   /* If last members of struct lconv equal CHAR_MAX, no grouping is done 
*/   
+   /* If last members of struct lconv equal CHAR_MAX, no grouping is done 
*/
 
 /* This is bad, but since we are going to be hardcoding in the POSIX stuff 
anyway... */
 # ifndef HAVE_LIMITS_H
@@ -101,7 +102,7 @@
REGISTER_LONG_CONSTANT(LC_MESSAGES, LC_MESSAGES, CONST_CS | 
CONST_PERSISTENT);
 # endif
 #endif
-   
+
 }
 /* }}} */
 
@@ -125,14 +126,14 @@
size_t i, j;
 
result = (unsigned char *) safe_emalloc(oldlen * 2, sizeof(char), 1);
-   
+
for (i = j = 0; i  oldlen; i++) {
result[j++] = hexconvtab[old[i]  4];
result[j++] = hexconvtab[old[i]  15];
}
result[j] = '\0';
 
-   if (newlen) 
+   if (newlen)
*newlen = oldlen * 2 * sizeof(char);
 
return (char*)result;
@@ -199,7 +200,7 @@
}
 
result = php_bin2hex(data, data_len, newlen);
-   
+
if (!result) {
RETURN_FALSE;
}
@@ -217,7 +218,7 @@
int len1, len2;
zend_uchar type1, type2;
long start, len; /* For UNICODE, these are codepoint units */
-   
+
start = 0;
len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, TT|ll,
@@ -225,13 +226,13 @@
  start, len) == 
FAILURE) {
return;
}
-   
+
if (ZEND_NUM_ARGS()  4) {
len = len1;
}
-   
+
/* look at substr() function for more information */
-   
+
if (start  0) {
start += len1;
if (start  0) {
@@ -240,14 +241,14 @@
} else if (start  len1) {
RETURN_FALSE;
}
-   
+
if (len  0) {
len += (len1 - start);
if (len  0) {
len = 0;
}
}
-   
+
if (((unsigned) start + (unsigned) len)  len1) {
len = len1 - start;
}
@@ -480,7 +481,7 @@
 {
zval **item;
char *value;
-   
+
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, item) == 
FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -509,7 +510,7 @@
convert_to_string_ex(s1);
convert_to_string_ex(s2);
 
-   RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1), 
+   RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1),
(const char *) Z_STRVAL_PP(s2)));
 }
 /* }}} */
@@ -517,7 +518,7 @@
 
 /* {{{ php_charmask
  * Fills a 256-byte bytemask with input. You can specify a range like 'a..z',
- * it needs to be incrementing.  
+ * it needs to be incrementing.
  * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range 
errors)
  */
 static inline int php_charmask(unsigned char *input, int len, char *mask 
TSRMLS_DC)
@@ -528,8 +529,8 @@
 
memset(mask, 0, 256);
for (end = input+len; input  end; input++) {
-   c=*input; 
-   if ((input+3  end)  input[1] == '.'  input[2] == '.' 
+   c=*input;
+   if ((input+3  end)  input[1] == '.'  input[2] == '.'
 input[3] = c) {
memset(mask+c, 1, input[3] - c + 1);
input+=3;
@@ -550,7 +551,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Invalid '..'-range, '..'-range needs to be incrementing.);
result = FAILURE;
continue;
-   } 
+   }
/* FIXME: better error 

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

2006-07-13 Thread Antony Dovgal
tony2001Thu Jul 13 17:55:50 2006 UTC

  Modified files:  
/php-src/main   main.c 
/php-src/ext/standard   string.c 
  Log:
  initialize variables
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.695r2=1.696diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.695 php-src/main/main.c:1.696
--- php-src/main/main.c:1.695   Wed Jul 12 17:04:13 2006
+++ php-src/main/main.c Thu Jul 13 17:55:50 2006
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.695 2006/07/12 17:04:13 andrei Exp $ */
+/* $Id: main.c,v 1.696 2006/07/13 17:55:50 tony2001 Exp $ */
 
 /* {{{ includes
  */
@@ -534,7 +534,7 @@
zstr function = NULL_ZSTR;
char *origin;
char *message;
-   char *stage;
+   char *stage = Unknown;
int function_name_is_string = 1;
 
/* get error text into buffer and escape for html if necessary */
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.548r2=1.549diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.548 php-src/ext/standard/string.c:1.549
--- php-src/ext/standard/string.c:1.548 Wed Jul 12 12:33:04 2006
+++ php-src/ext/standard/string.c   Thu Jul 13 17:55:50 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.548 2006/07/12 12:33:04 tony2001 Exp $ */
+/* $Id: string.c,v 1.549 2006/07/13 17:55:50 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1326,7 +1326,7 @@
UChar *u_token, *u_p, *u_pe;
 
UChar32 ch, th;
-   int32_t start, end, i, j, rem_len;
+   int32_t start = 0, end, i, j, rem_len;
int delim_found, token_present;
int skipped = 0;
 
@@ -2111,7 +2111,7 @@
char needle_char[2];
UChar u_needle_char[3];
int needle_len;
-   char *haystack_copy;
+   char *haystack_copy = NULL;
zstr target;
void *found = NULL;
int found_offset;
@@ -2411,9 +2411,9 @@
zend_uchar str_type;
void *haystack_dup, *needle_dup = NULL;
char needle_char[2];
-   char c;
+   char c = 0;
UChar u_needle_char[3];
-   UChar32 ch;
+   UChar32 ch = 0;
void *found = NULL;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz|l, haystack, 
needle, offset) == FAILURE) {
@@ -3908,10 +3908,10 @@
 PHP_FUNCTION(strrev)
 {
zval **str;
-   char *s, *e, *n, *p;
+   char *s, *e, *n = NULL, *p;
int32_t i, x1, x2;
UChar32 ch;
-   UChar *u_s, *u_n, *u_p;
+   UChar *u_s, *u_n = NULL, *u_p;

if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, str) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -6316,7 +6316,7 @@
int ac = ZEND_NUM_ARGS();
int count = 0;
void *p, *endp, *tmp;
-   int32_t i, j;
+   int32_t i = 0, j;
char cmp;
 
if (zend_parse_parameters(ac TSRMLS_CC, TT|ll,
@@ -6798,7 +6798,7 @@
 
if (haystack_type == IS_UNICODE) {
int32_t i, j;
-   UChar32 ch1, ch2;
+   UChar32 ch1, ch2 = 0;
 
for (i = 0 ; i  haystack_len ; ) {
U16_NEXT((UChar *)haystack, i, haystack_len, ch1);

-- 
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-07-13 Thread Andrei Zmievski
andrei  Thu Jul 13 22:26:50 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  FIXME note
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.550r2=1.551diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.550 php-src/ext/standard/string.c:1.551
--- php-src/ext/standard/string.c:1.550 Thu Jul 13 21:27:48 2006
+++ php-src/ext/standard/string.c   Thu Jul 13 22:26:50 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.550 2006/07/13 21:27:48 andrei Exp $ */
+/* $Id: string.c,v 1.551 2006/07/13 22:26:50 andrei Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4065,6 +4065,7 @@
sum += php_u_similar_char(txt1, pos1, txt2, pos2);
}
if ((pos1 + end1  len1)  (pos2 + end2  len2)) {
+   /* FIXME should this be calling php_u_similar_char? */
sum += php_similar_char((UChar *)txt1+pos1+end1, 
len1-pos1-end1,
(UChar 
*)txt2+pos2+end2, len2-pos2-end2);
}

-- 
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 /ext/standard/tests/strings stripos.phpt

2006-07-12 Thread Antony Dovgal
tony2001Wed Jul 12 12:33:05 2006 UTC

  Added files: 
/php-src/ext/standard/tests/strings stripos.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  don't try to compare strings if haystack is  or shorter than needle
  add test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.547r2=1.548diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.547 php-src/ext/standard/string.c:1.548
--- php-src/ext/standard/string.c:1.547 Fri Jun 30 09:35:21 2006
+++ php-src/ext/standard/string.c   Wed Jul 12 12:33:04 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.547 2006/06/30 09:35:21 tony2001 Exp $ */
+/* $Id: string.c,v 1.548 2006/07/12 12:33:04 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2429,8 +2429,13 @@
}
 
haystack_len = Z_UNILEN_P(haystack);
+
+   if (haystack_len == 0) {
+   RETURN_FALSE;
+   }
+
if (Z_TYPE_P(needle) == IS_UNICODE || Z_TYPE_P(needle) == IS_STRING) {
-   if (!Z_UNILEN_P(needle)) {
+   if (!Z_UNILEN_P(needle) || Z_UNILEN_P(needle)  haystack_len) {
RETURN_FALSE;
}
if (Z_TYPE_P(haystack) != Z_TYPE_P(needle)) {

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/stripos.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/stripos.phpt
+++ php-src/ext/standard/tests/strings/stripos.phpt
--TEST--
stripos() function test
--FILE--
?php
var_dump(stripos(test string, TEST));
var_dump(stripos(test string, strIng));
var_dump(stripos(test string, stRin));
var_dump(stripos(test string, t S));
var_dump(stripos(test string, G));
var_dump(stripos(te.chr(0).st, chr(0)));
var_dump(stripos(tEst, test));
var_dump(stripos(teSt, test));
var_dump(stripos(, ));
var_dump(stripos(a, ));
var_dump(stripos(, a));
var_dump(stripos(a,  ));
var_dump(stripos(a, a));
var_dump(stripos(, 1));
var_dump(stripos(, false));
var_dump(stripos(, true));
var_dump(stripos(a, 1));
var_dump(stripos(a, false));
var_dump(stripos(a, true));
var_dump(stripos(1, 1));
var_dump(stripos(0, false));
var_dump(stripos(1, true));
var_dump(stripos(a, \\a));

echo Done\n;
?
--EXPECT--
int(0)
int(5)
int(5)
int(3)
int(10)
int(2)
int(0)
int(0)
bool(false)
bool(false)
bool(false)
bool(false)
int(0)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
int(1)
Done

-- 
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-06-30 Thread Antony Dovgal
tony2001Fri Jun 30 09:35:22 2006 UTC

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  fix off-by-one in addslashes() in Unicode mode
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.546r2=1.547diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.546 php-src/ext/standard/string.c:1.547
--- php-src/ext/standard/string.c:1.546 Sun Jun 25 19:19:31 2006
+++ php-src/ext/standard/string.c   Fri Jun 30 09:35:21 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.546 2006/06/25 19:19:31 bjori Exp $ */
+/* $Id: string.c,v 1.547 2006/06/30 09:35:21 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4448,7 +4448,7 @@
return str;
}
 
-   buf = eumalloc(length * 2);
+   buf = eumalloc(length * 2 + 1);
 
while (i  length) {
U16_NEXT(str, i, length, ch);

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



  1   2   3   >