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

2009-03-16 Thread Matt Wilmas
mattwil Tue Mar 17 00:02:40 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  Removed unneeded HashPosition variable (php_implode() doesn't change the 
internal pointer)
  - It was added in '06 with the "200-300%" implode() optimization (hasn't been 
merged to HEAD)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.43&r2=1.445.2.14.2.69.2.44&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.43 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.44
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.43  Tue Mar  3 11:47:31 2009
+++ php-src/ext/standard/string.c   Tue Mar 17 00:02:39 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.43 2009/03/03 11:47:31 kalle Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.44 2009/03/17 00:02:39 mattwil Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1130,7 +1130,6 @@
 PHP_FUNCTION(implode)
 {
zval **arg1 = NULL, **arg2 = NULL, *delim, *arr;
-   HashPosition pos;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|Z", &arg1, 
&arg2) == FAILURE) {
return;
@@ -1162,13 +1161,9 @@
return;
}
}
-
-   pos = Z_ARRVAL_P(arr)->pInternalPointer;

php_implode(delim, arr, return_value TSRMLS_CC);
 
-   Z_ARRVAL_P(arr)->pInternalPointer = pos;
-
if (arg2 == NULL) {
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(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings bug47546.phpt

2009-03-03 Thread Kalle Sommer Nielsen
kalle   Tue Mar  3 11:47:31 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug47546.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFH: 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.445.2.14.2.69.2.42&r2=1.445.2.14.2.69.2.43&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.42 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.43
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.42  Sat Feb 14 06:59:55 2009
+++ php-src/ext/standard/string.c   Tue Mar  3 11:47:31 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.42 2009/02/14 06:59:55 moriyoshi Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.43 2009/03/03 11:47:31 kalle Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1027,7 +1027,7 @@
 
if (limit == 0 || limit == 1) {
add_index_stringl(return_value, 0, Z_STRVAL_PP(str), 
Z_STRLEN_PP(str), 1);
-   } else if (limit < 0 && argc == 3) {
+   } else if (limit < -1 && argc == 3) {
php_explode_negative_limit(*delim, *str, return_value, limit);
} else {
php_explode(*delim, *str, return_value, limit);

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug47546.phpt?view=markup&rev=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--

--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(PHP_5_3) /ext/standard string.c

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

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  - MFH: These should be E_WARNING for consistency with strpos()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.41&r2=1.445.2.14.2.69.2.42&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.41 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.42
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.41  Fri Jan 30 00:16:27 2009
+++ php-src/ext/standard/string.c   Sat Feb 14 06:59:55 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.41 2009/01/30 00:16:27 iliaa Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.42 2009/02/14 06:59:55 moriyoshi Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1833,14 +1833,14 @@
 
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 + offset;
e = haystack + 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;
}
 
@@ -1909,7 +1909,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");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Offset is greater than the length of haystack string");
RETURN_FALSE;
}
p = haystack + offset;
@@ -1917,7 +1917,7 @@
} else {
p = haystack;
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;
}
e = haystack + haystack_len + offset;
@@ -1942,7 +1942,7 @@
if (offset > haystack_len) {
efree(needle_dup);
efree(haystack_dup);
-   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_dup + offset;
@@ -1951,7 +1951,7 @@
if (-offset > haystack_len || offset < -INT_MAX) {
efree(needle_dup);
efree(haystack_dup);
-   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_dup;



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



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

2009-01-29 Thread Ilia Alshanetsky
iliaa   Fri Jan 30 00:16:28 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  
  Improved validation checks inside str_pad()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.40&r2=1.445.2.14.2.69.2.41&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.40 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.41
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.40  Wed Dec 31 11:15:46 2008
+++ php-src/ext/standard/string.c   Fri Jan 30 00:16:27 2009
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.40 2008/12/31 11:15:46 sebastian Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.41 2009/01/30 00:16:27 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4816,7 +4816,7 @@
 
/* If resulting string turns out to be shorter than input string,
   we simply copy the input and return. */
-   if (pad_length < 0 || num_pad_chars < 0) {
+   if (pad_length <= 0 || num_pad_chars <= 0) {
RETURN_STRINGL(input, input_len, 1);
}
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings explode.phpt

2008-12-26 Thread Brian Shire
shire   Sat Dec 27 05:15:51 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings explode.phpt 
  Log:
  MFH: 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.445.2.14.2.69.2.38&r2=1.445.2.14.2.69.2.39&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.38 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.39
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.38  Fri Nov 21 19:16:50 2008
+++ php-src/ext/standard/string.c   Sat Dec 27 05:15:51 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.38 2008/11/21 19:16:50 felipe Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.39 2008/12/27 05:15:51 shire Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1018,7 +1018,9 @@
array_init(return_value);
 
if (! Z_STRLEN_PP(str)) {
-   add_next_index_stringl(return_value, "", sizeof("") - 1, 1);
+   if (limit >= 0 || argc == 2) {
+   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.4.4.1.2.1&r2=1.4.4.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/strings/explode.phpt
diff -u php-src/ext/standard/tests/strings/explode.phpt:1.4.4.1.2.1 
php-src/ext/standard/tests/strings/explode.phpt:1.4.4.1.2.2
--- php-src/ext/standard/tests/strings/explode.phpt:1.4.4.1.2.1 Tue Dec 18 
10:53:39 2007
+++ php-src/ext/standard/tests/strings/explode.phpt Sat Dec 27 05:15:51 2008
@@ -17,6 +17,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)));
@@ -63,6 +64,8 @@
   [0]=>
   string(11) "otherstring"
 }
+array(0) {
+}
 array(7) {
   [0]=>
   string(0) ""



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings bug46578.phpt

2008-11-21 Thread Felipe Pena
felipe  Fri Nov 21 19:16:50 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug46578.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - MFH: 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.445.2.14.2.69.2.37&r2=1.445.2.14.2.69.2.38&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.37 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.38
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.37  Sun Nov  2 18:24:34 2008
+++ php-src/ext/standard/string.c   Fri Nov 21 19:16:50 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.37 2008/11/02 18:24:34 felipe Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.38 2008/11/21 19:16:50 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4353,7 +4353,10 @@
 
case '"':
case '\'':
-   if (state == 2 && *(p-1) != '\\') {
+   if (state == 4) {
+   /* Inside  */
+   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=markup&rev=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--
foobar'));

var_dump(strip_tags('foobar'));

var_dump(strip_tags('foo */ 
?>bar'));

var_dump(strip_tags('< ax'));

var_dump(strip_tags(''));

var_dump(strip_tags('
--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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings setlocale_error.phpt strtok_error.phpt strtok_variation1.phpt strtok_variation2.phpt

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

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings setlocale_error.phpt 
strtok_error.phpt 
strtok_variation1.phpt 
strtok_variation2.phpt 
  Log:
  - New parameter parsing API (zend_get_parameters_array_ex--)
  - Fixed tests
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.34&r2=1.445.2.14.2.69.2.35&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.34 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.35
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.34  Thu Aug 14 02:56:23 2008
+++ php-src/ext/standard/string.c   Sat Aug 16 21:32:41 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.34 2008/08/14 02:56:23 kalle Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.35 2008/08/16 21:32:41 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1177,38 +1177,34 @@
 /* {{{ proto string strtok([string str,] string token)
Tokenize a string */
 PHP_FUNCTION(strtok)
-{
-   zval **args[2];
-   zval **tok, **str;
+{  
+   char *str, *tok = NULL;
+   int str_len, tok_len = 0;
+   zval *zv;
+   
char *token;
char *token_end;
char *p;
char *pe;
int skipped = 0;

-   if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 || 
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, 
&str_len, &tok, &tok_len) == FAILURE) {
+   return;
}
-   
-   switch (ZEND_NUM_ARGS()) {
-   case 1:
-   tok = args[0];
-   break;
 
-   default:
-   case 2:
-   str = args[0];
-   tok = args[1];
-   convert_to_string_ex(str);
-
-   zval_add_ref(str);
-   if (BG(strtok_zval)) {
-   zval_ptr_dtor(&BG(strtok_zval));
-   }
-   BG(strtok_zval) = *str;
-   BG(strtok_last) = BG(strtok_string) = Z_STRVAL_PP(str);
-   BG(strtok_len) = Z_STRLEN_PP(str);
-   break;
+   if (ZEND_NUM_ARGS() == 1) {
+   tok = str;
+   tok_len = str_len;
+   } else {
+   if (BG(strtok_zval)) {
+   zval_ptr_dtor(&BG(strtok_zval));
+   }
+   MAKE_STD_ZVAL(zv);
+   ZVAL_STRINGL(zv, str, str_len, 1);
+
+   BG(strtok_zval) = zv;
+   BG(strtok_last) = BG(strtok_string) = Z_STRVAL_P(zv);
+   BG(strtok_len) = str_len;
}

p = BG(strtok_last); /* Where we start to search */
@@ -1217,11 +1213,9 @@
if (!p || p >= pe) {
RETURN_FALSE;
}
-
-   convert_to_string_ex(tok);

-   token = Z_STRVAL_PP(tok);
-   token_end = token + Z_STRLEN_PP(tok);
+   token = tok;
+   token_end = token + tok_len;
 
while (token < token_end) {
STRTOK_TABLE(token++) = 1;
@@ -1256,7 +1250,7 @@
 
/* Restore table -- usually faster then memset'ing the table on every 
invocation */
 restore:
-   token = Z_STRVAL_PP(tok);
+   token = tok;

while (token < token_end) {
STRTOK_TABLE(token++) = 0;
@@ -4001,61 +3995,64 @@
Set locale information */
 PHP_FUNCTION(setlocale)
 {
-   zval ***args = (zval ***) safe_emalloc(sizeof(zval **), 
ZEND_NUM_ARGS(), 0);
+   zval ***args = NULL;
zval **pcategory, **plocale;
-   int i, cat, n_args=ZEND_NUM_ARGS();
+   int num_args, cat, i = 0;
char *loc, *retval;
 
-   if (zend_get_parameters_array_ex(n_args, args) == FAILURE || n_args < 
2) {
-   efree(args);
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z+", &pcategory, 
&args, &num_args) == FAILURE) {
+   return;
}
+
 #ifdef HAVE_SETLOCALE
-   pcategory = args[0];
if (Z_TYPE_PP(pcategory) == IS_LONG) {
convert_to_long_ex(pcategory);  
cat = Z_LVAL_PP(pcategory);
-   } else { /* FIXME: The following behaviour should be removed. */
+   } else {
+   /* FIXME: The following behaviour should be removed. */
char *category;
+   
php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "Passing locale 
category name as string is deprecated. Use the LC_* 

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

2008-08-06 Thread Derick Rethans
On Tue, 5 Aug 2008, Olivier Hill wrote:

> What should be MFH'ed?
> 
> I haven't touched HEAD with this. I don't have cvs access here, will
> only be able to commit friday.
> 
> Is there still regression issues or my last patch fixed it?

Looks fine - I missed your patch on the list though.

regards,
Derick

-- 
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org

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



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

2008-08-05 Thread Olivier Hill
What should be MFH'ed?

I haven't touched HEAD with this. I don't have cvs access here, will
only be able to commit friday.

Is there still regression issues or my last patch fixed it?

Thanks
Olivier (Mobile)



On 8/5/08, Lukas Kahwe Smith <[EMAIL PROTECTED]> wrote:
>
> On 31.07.2008, at 09:18, Derick Rethans wrote:
>
>> On Mon, 28 Jul 2008, Olivier Hill wrote:
>>
>>> Indeed, I forgot to test that case. If I remember correctly, there
>>> was
>>> no test cases for that function, so I'll fix this tonight and add
>>> some
>>> tests.
>>
>> I didn't see a commit - have you forgotten about it?
>>
>> regards,
>> Derick
>
>
> still not MFH'ed .. or?
>
> regards,
> Lukas Kahwe Smith
> [EMAIL PROTECTED]
>
>
>
>


-- 
Olivier Hill, ing. jr.
http://www.olivierhill.ca/

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



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

2008-08-05 Thread Lukas Kahwe Smith


On 31.07.2008, at 09:18, Derick Rethans wrote:


On Mon, 28 Jul 2008, Olivier Hill wrote:

Indeed, I forgot to test that case. If I remember correctly, there  
was
no test cases for that function, so I'll fix this tonight and add  
some

tests.


I didn't see a commit - have you forgotten about it?

regards,
Derick



still not MFH'ed .. or?

regards,
Lukas Kahwe Smith
[EMAIL PROTECTED]




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



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

2008-07-31 Thread Olivier Hill
ohill   Thu Jul 31 14:20:41 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  Fix regression issue
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.32&r2=1.445.2.14.2.69.2.33&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.32 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.33
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.32  Tue Jul 22 01:10:58 2008
+++ php-src/ext/standard/string.c   Thu Jul 31 14:20:40 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.32 2008/07/22 01:10:58 scottmac Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.33 2008/07/31 14:20:40 ohill Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4104,10 +4104,6 @@
return;
}
 
-   if (!arglen) {
-   return;
-   }
-
res = estrndup(arg, arglen);
 
if (arrayArg == NULL) {



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



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

2008-07-31 Thread Derick Rethans
On Mon, 28 Jul 2008, Olivier Hill wrote:

> Indeed, I forgot to test that case. If I remember correctly, there was
> no test cases for that function, so I'll fix this tonight and add some
> tests.

I didn't see a commit - have you forgotten about it?

regards,
Derick

-- 
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org

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



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

2008-07-28 Thread Olivier Hill
Indeed, I forgot to test that case. If I remember correctly, there was
no test cases for that function, so I'll fix this tonight and add some
tests.

Regards



On 7/28/08, Derick Rethans <[EMAIL PROTECTED]> wrote:
> On Wed, 25 Jun 2008, Olivier Hill wrote:
>
>> ohillWed Jun 25 12:16:17 2008 UTC
>>
>>   Modified files:  (Branch: PHP_5_3)
>> /php-src/ext/standardstring.c
>
> 
>
>>   Log:
>>   New parameter parsing API
>
> The following change introduces a regression:
>
> @@ -4135,24 +4095,23 @@
> Parses GET/POST/COOKIE data and sets global variables */
>  PHP_FUNCTION(parse_str)
>  {
> -   zval **arg;
> -   zval **arrayArg;
> +   char *arg;
> +   zval **arrayArg = NULL;
> zval *sarg;
> char *res = NULL;
> -   int argCount;
> +   int arglen;
>
> -   argCount = ZEND_NUM_ARGS();
> -   if (argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount,
> &arg, &arrayArg) == FAILURE) {
> -   WRONG_PARAM_COUNT;
> +   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Z", &arg,
> &arglen, &arrayArg) == FAILURE) {
> +   return;
> }
>
> -   convert_to_string_ex(arg);
> -   sarg = *arg;
> -   if (Z_STRVAL_P(sarg) && *Z_STRVAL_P(sarg)) {
> -   res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg));
> +   if (!arglen) {
> +   return;
> }
>
> -   if (argCount == 1) {
> +   res = estrndup(arg, arglen);
> +
> +   if (arrayArg == NULL) {
> zval tmp;
>
> if (!EG(active_symbol_table)) {
>
>
> [EMAIL PROTECTED]:~$ php-5.2dev -r 'parse_str( "", $p ); var_dump( $p );'
>
> array(0) {
> }
>
> [EMAIL PROTECTED]:~$ php-5.3dev -r 'parse_str( "", $p ); var_dump( $p );'
> NULL
>
> Please fix this - a test file is attached.
>
> regards,
> Derick
>
> --
> HEAD before 5_3!: http://tinyurl.com/6d2esb
> http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org


-- 
Olivier Hill, ing. jr.
http://www.olivierhill.ca/

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



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

2008-07-28 Thread Derick Rethans
On Wed, 25 Jun 2008, Olivier Hill wrote:

> ohill Wed Jun 25 12:16:17 2008 UTC
> 
>   Modified files:  (Branch: PHP_5_3)
> /php-src/ext/standard string.c 



>   Log:
>   New parameter parsing API

The following change introduces a regression:

@@ -4135,24 +4095,23 @@
Parses GET/POST/COOKIE data and sets global variables */
 PHP_FUNCTION(parse_str)
 {
-   zval **arg;
-   zval **arrayArg;
+   char *arg;
+   zval **arrayArg = NULL;
zval *sarg;
char *res = NULL;
-   int argCount;
+   int arglen;
 
-   argCount = ZEND_NUM_ARGS();
-   if (argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, 
&arg, &arrayArg) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Z", &arg, 
&arglen, &arrayArg) == FAILURE) {
+   return;
}
 
-   convert_to_string_ex(arg);
-   sarg = *arg;
-   if (Z_STRVAL_P(sarg) && *Z_STRVAL_P(sarg)) {
-   res = estrndup(Z_STRVAL_P(sarg), Z_STRLEN_P(sarg));
+   if (!arglen) {
+   return;
}
 
-   if (argCount == 1) {
+   res = estrndup(arg, arglen);
+
+   if (arrayArg == NULL) {
zval tmp;
 
if (!EG(active_symbol_table)) {


[EMAIL PROTECTED]:~$ php-5.2dev -r 'parse_str( "", $p ); var_dump( $p );'

array(0) {
}

[EMAIL PROTECTED]:~$ php-5.3dev -r 'parse_str( "", $p ); var_dump( $p );'
NULL

Please fix this - a test file is attached.

regards,
Derick

-- 
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org--TEST--
parse_str() with empty query string
--FILE--

--EXPECT--
array(0) {
}
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings strrpos_offset.phpt

2008-07-21 Thread Scott MacVicar
scottmacTue Jul 22 01:10:59 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings strrpos_offset.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFH: Fix integer oveflow in strrpos()
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.31&r2=1.445.2.14.2.69.2.32&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.31 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.32
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.31  Tue Jul 15 14:46:11 2008
+++ php-src/ext/standard/string.c   Tue Jul 22 01:10:58 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.31 2008/07/15 14:46:11 scottmac Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.32 2008/07/22 01:10:58 scottmac Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1842,7 +1842,7 @@
p = haystack + offset;
e = haystack + 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=markup&rev=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--

--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(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings strip_tags_variation11.phpt

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

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings strip_tags_variation11.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  MFH: Fix bug when < is used within attribute.
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.30&r2=1.445.2.14.2.69.2.31&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.30 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.31
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.30  Fri Jul 11 12:25:37 2008
+++ php-src/ext/standard/string.c   Tue Jul 15 14:46:11 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.30 2008/07/11 12:25:37 felipe Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.31 2008/07/15 14:46:11 scottmac Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4249,6 +4249,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=markup&rev=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--
 world',
  'hello  world',
  'hello  world',
  "hello  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(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings bug45485.phpt

2008-07-11 Thread Felipe Pena
felipe  Fri Jul 11 12:25:38 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug45485.phpt 

  Modified files:  
/php-src/ext/standard   string.c 
  Log:
  - MFB: Fixed bug #45485 (strip_tags and http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.29&r2=1.445.2.14.2.69.2.30&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.29 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.30
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.29  Thu Jul  3 14:00:20 2008
+++ php-src/ext/standard/string.c   Fri Jul 11 12:25:37 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.29 2008/07/03 14:00:20 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.30 2008/07/11 12:25:37 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -4413,12 +4413,13 @@
/* fall-through */
 
case 'l':
+   case 'L':
 
/* swm: If we encounter ' 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?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/bug45485.phpt
+++ php-src/ext/standard/tests/strings/bug45485.phpt



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



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

2008-07-03 Thread Antony Dovgal
tony2001Thu Jul  3 14:00:21 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  size_t -> int
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.28&r2=1.445.2.14.2.69.2.29&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.28 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.29
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.28  Tue Jul  1 11:27:05 2008
+++ php-src/ext/standard/string.c   Thu Jul  3 14:00:20 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.28 2008/07/01 11:27:05 felipe Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.29 2008/07/03 14:00:20 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -183,7 +183,8 @@
 PHP_FUNCTION(bin2hex)
 {
char *result, *data;
-   size_t newlen, datalen;
+   size_t newlen;
+   int datalen;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, 
&datalen) == FAILURE) {
return;



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



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

2008-07-01 Thread Felipe Pena
felipe  Tue Jul  1 11:27:05 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  - Removed unused variables
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.27&r2=1.445.2.14.2.69.2.28&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.27 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.28
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.27  Mon Jun 30 10:39:34 2008
+++ php-src/ext/standard/string.c   Tue Jul  1 11:27:05 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.27 2008/06/30 10:39:34 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.28 2008/07/01 11:27:05 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -997,7 +997,7 @@
Splits a string on string separator and return array of components. If 
limit is positive only limit number of components is returned. If limit is 
negative all components except the last abs(limit) are returned. */
 PHP_FUNCTION(explode)
 {
-   zval **str, **delim, **zlimit = NULL;
+   zval **str, **delim;
long limit = -1;
int argc = ZEND_NUM_ARGS();

@@ -4096,7 +4096,6 @@
 {
char *arg;
zval **arrayArg = NULL;
-   zval *sarg;
char *res = NULL;
int arglen;
 



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



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

2008-06-30 Thread Antony Dovgal

On 30.06.2008 14:39, Antony Dovgal wrote:

tony2001Mon Jun 30 10:39:35 2008 UTC

  Added files: (Branch: PHP_5_3)
/pecl/sdo/SCA/Bindings/atom	Atom1.0.xsd xhtml1-strict.xsd 
   	ServiceRequestHandler.php Proxy.php 
   	.cvsignore xml.xsd AtomDas.php 
   	RequestTester.php SCA_AtomServer.php 
   	SCA_ServiceWrapperAtom.php Atom1.0.xsd 
   	ServiceRequestHandler.php 
   	SCA_AtomServer.php 
   	SCA_ServiceWrapperAtom.php AtomDas.php 
   	RequestTester.php .cvsignore xml.xsd 
   	xhtml1-strict.xsd Proxy.php 


WTH?!
Since when "cvs ci ext/standard/string.c" modifies something else than 
ext/standard/string.c ?

Here is full error log I received:
---
COMMITINFO /repository/php-src/ext/standard string.c
Checking in ext/standard/string.c;
/repository/php-src/ext/standard/string.c,v  <--  string.c
new revision: 1.445.2.14.2.69.2.27; previous revision: 1.445.2.14.2.69.2.26
done
42862 LOGINFO php-cvs@lists.php.net tony2001 php-src/ext/standard 
string.c,1.445.2.14.2.69.2.26,1.445.2.14.2.69.2.27
Use of uninitialized value in string eq at /repository/CVSROOT/loginfo.pl line 127, 
 line 11.
Use of uninitialized value in string eq at /repository/CVSROOT/loginfo.pl line 127, 
 line 11.
Use of uninitialized value in concatenation (.) or string at 
/repository/CVSROOT/loginfo.pl line 152.
Use of uninitialized value in concatenation (.) or string at 
/repository/CVSROOT/loginfo.pl line 152.
Use of uninitialized value in concatenation (.) or string at 
/repository/CVSROOT/loginfo.pl line 153.
Use of uninitialized value in concatenation (.) or string at 
/repository/CVSROOT/loginfo.pl line 153.
cvs rdiff: cannot find module `pecl/sdo/SCA/Bindings/atom/binding' - ignored
42863 Mailing the commit email to php-cvs@lists.php.net

--
Wbr, 
Antony Dovgal


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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard string.c pecl/sdo/SCA/Bindings/atom .cvsignore .cvsignore Atom1.0.xsd Atom1.0.xsd AtomDas.php AtomDas.php Proxy.php Proxy.php RequestTester.php RequestTe

2008-06-30 Thread Antony Dovgal
tony2001Mon Jun 30 10:39:35 2008 UTC

  Added files: (Branch: PHP_5_3)
/pecl/sdo/SCA/Bindings/atom Atom1.0.xsd xhtml1-strict.xsd 
ServiceRequestHandler.php Proxy.php 
.cvsignore xml.xsd AtomDas.php 
RequestTester.php SCA_AtomServer.php 
SCA_ServiceWrapperAtom.php Atom1.0.xsd 
ServiceRequestHandler.php 
SCA_AtomServer.php 
SCA_ServiceWrapperAtom.php AtomDas.php 
RequestTester.php .cvsignore xml.xsd 
xhtml1-strict.xsd Proxy.php 

  Modified files:  
/pecl/sdo/SCA/Bindings/atom binding 
/php-src/ext/standard   string.c 
  Log:
  "l" is long, that's why it is "l", not "i"
  
  
http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/binding?r1=&r2=&diff_format=u
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.26&r2=1.445.2.14.2.69.2.27&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.26 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.27
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.26  Mon Jun 30 10:10:44 2008
+++ php-src/ext/standard/string.c   Mon Jun 30 10:39:34 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.26 2008/06/30 10:10:44 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.27 2008/06/30 10:39:34 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1690,7 +1690,7 @@
char *haystack;
char *found = NULL;
char  needle_char[2];
-   int   offset = 0;
+   long  offset = 0;
int   haystack_len;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|l", &haystack, 
&haystack_len, &needle, &offset) == FAILURE) {
@@ -2124,8 +2124,7 @@
 PHP_FUNCTION(substr)
 {
char *str;
-   int l;
-   int f;
+   long l, f;
int str_len;
int argc = ZEND_NUM_ARGS();

@@ -4457,7 +4456,7 @@
 {
char*input_str; /* Input string */
int input_len;
-   int mult;   /* Multiplier */
+   longmult;   /* Multiplier */
char*result;/* Resulting string */
size_t  result_len; /* Length of the resulting 
string */

@@ -4509,7 +4508,7 @@
 {
char *input;
int chars[256];
-   int mymode=0;
+   long mymode=0;
unsigned char *buf;
int len, inx;
char retstr[256];
@@ -4695,8 +4694,7 @@
 PHP_FUNCTION(substr_count)
 {
char *haystack, *needle;
-   int offset = 0;
-   int length;
+   long offset = 0, length;
int ac = ZEND_NUM_ARGS();
int count = 0;
int haystack_len, needle_len;
@@ -4763,7 +4761,7 @@
/* Input arguments */
char *input;/* Input string */
int  input_len;
-   int  pad_length;/* Length to pad to */
+   long pad_length;/* Length to pad to */

/* Helper variables */
intnum_pad_chars;   /* Number of padding characters 
(total - input size) */
@@ -4771,7 +4769,7 @@
intresult_len = 0;  /* Length of the resulting 
string */
char  *pad_str_val = " ";   /* Pointer to padding string */
intpad_str_len = 1; /* Length of the padding string */
-   intpad_type_val = STR_PAD_RIGHT; /* The padding type value */
+   long   pad_type_val = STR_PAD_RIGHT; /* The padding type value */
inti, left_pad=0, right_pad=0;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|sl", &input, 
&input_len, &pad_length,

http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/Atom1.0.xsd?view=markup&rev=1.1
Index: pecl/sdo/SCA/Bindings/atom/Atom1.0.xsd
+++ pecl/sdo/SCA/Bindings/atom/Atom1.0.xsd

http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/xhtml1-strict.xsd?view=markup&rev=1.1
Index: pecl/sdo/SCA/Bindings/atom/xhtml1-strict.xsd
+++ pecl/sdo/SCA/Bindings/atom/xhtml1-strict.xsd

http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/ServiceRequestHandler.php?view=markup&rev=1.1
Index: pecl/sdo/SCA/Bindings/atom/ServiceRequestHandler.php
+++ pecl/sdo/SCA/Bindings/atom/ServiceRequestHandler.php

http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/Proxy.php?view=markup&rev=1.1
Index: pecl/sdo/SCA/Bindings/atom/Proxy.php
+++ pecl/sdo/SCA/Bindings/atom/Proxy.php

http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/atom/.cvsignore?view=markup&rev=1.1
Index: pecl/sdo/SCA/B

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

2008-06-30 Thread Antony Dovgal
tony2001Mon Jun 30 10:10:45 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  int -> long
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.25&r2=1.445.2.14.2.69.2.26&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.25 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.26
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.25  Wed Jun 25 12:16:16 2008
+++ php-src/ext/standard/string.c   Mon Jun 30 10:10:44 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.25 2008/06/25 12:16:16 ohill Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.26 2008/06/30 10:10:44 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -998,7 +998,7 @@
 PHP_FUNCTION(explode)
 {
zval **str, **delim, **zlimit = NULL;
-   int limit = -1;
+   long limit = -1;
int argc = ZEND_NUM_ARGS();

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &delim, 
&str, &limit) == FAILURE) {



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



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

2008-06-23 Thread Dmitry Stogov
dmitry  Tue Jun 24 06:07:08 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  Fixed strtolower/strtoupper to not modify the passed argument
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.23&r2=1.445.2.14.2.69.2.24&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.23 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.24
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.23  Sun Jun 22 19:22:41 2008
+++ php-src/ext/standard/string.c   Tue Jun 24 06:07:08 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.23 2008/06/22 19:22:41 ohill Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.24 2008/06/24 06:07:08 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1291,9 +1291,9 @@
return;
}
 
-   php_strtoupper(arg, arglen);
-   
-   RETURN_STRINGL(arg, arglen, 1);
+   arg = estrndup(arg, arglen);
+   php_strtoupper(arg, arglen);
+   RETURN_STRINGL(arg, arglen, 0);
 }
 /* }}} */
 
@@ -1325,8 +1325,9 @@
return;
}
 
+   str = estrndup(str, arglen);
php_strtolower(str, arglen);
-   RETURN_STRINGL(str, arglen, 1);
+   RETURN_STRINGL(str, arglen, 0);
 }
 /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings chop_error.phpt chop_variation1.phpt chop_variation2.phpt chunk_split_variation1.phpt dirname_error.phpt explode1.ph

2008-06-22 Thread Olivier Hill
ohill   Sun Jun 22 19:22:41 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings chop_error.phpt 
chop_variation1.phpt 
chop_variation2.phpt 
chunk_split_variation1.phpt 
dirname_error.phpt 
explode1.phpt implode1.phpt 
join_error.phpt ltrim.phpt 
rtrim.phpt strpos.phpt 
strrchr_error.phpt 
strrchr_variation11.phpt 
strrchr_variation9.phpt 
trim1.phpt 
  Log:
  New parameter parsing API for string, part I
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.22&r2=1.445.2.14.2.69.2.23&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.22 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.23
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.22  Tue May 27 10:29:33 2008
+++ php-src/ext/standard/string.c   Sun Jun 22 19:22:41 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.22 2008/05/27 10:29:33 mattwil Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.23 2008/06/22 19:22:41 ohill Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -182,16 +182,14 @@
Converts the binary representation of data to hex */
 PHP_FUNCTION(bin2hex)
 {
-   zval **data;
-   char *result;
-   size_t newlen;
+   char *result, *data;
+   size_t newlen, datalen;
 
-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, 
&datalen) == FAILURE) {
+   return;
}
-   convert_to_string_ex(data);
 
-   result = php_bin2hex(Z_STRVAL_PP(data), Z_STRLEN_PP(data), &newlen);
+   result = php_bin2hex(data, datalen, &newlen);

if (!result) {
RETURN_FALSE;
@@ -637,16 +635,15 @@
Compares two strings using the current locale */
 PHP_FUNCTION(strcoll)
 {
-   zval **s1, **s2;
-
-   if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   char *s1, *s2;
+   int s1len, s2len;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, 
&s2, &s2len) == FAILURE) {
+   return;
}
-   convert_to_string_ex(s1);
-   convert_to_string_ex(s2);
 
-   RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1), 
-   (const char *) Z_STRVAL_PP(s2)));
+   RETURN_LONG(strcoll((const char *) s1, 
+   (const char *) s2));
 }
 /* }}} */
 #endif
@@ -752,22 +749,15 @@
  */
 static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode)
 {
-   zval **str;
-   zval **what = NULL;
-   intargc = ZEND_NUM_ARGS();
-
-   if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &str, &what) 
== FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
-
-   convert_to_string_ex(str);
-
-   if (argc > 1) {
-   convert_to_string_ex(what);
-   php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), Z_STRVAL_PP(what), 
Z_STRLEN_PP(what), return_value, mode TSRMLS_CC);
-   } else {
-   php_trim(Z_STRVAL_PP(str), Z_STRLEN_PP(str), NULL, 0, 
return_value, mode TSRMLS_CC);
+   char *str;
+   char *what = NULL;
+   int str_len, what_len = 0;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, 
&str_len, &what, &what_len) == FAILURE) {
+   return;
}
+   
+   php_trim(str, str_len, what, what_len, return_value, mode TSRMLS_CC);
 }
 /* }}} */
 
@@ -1010,18 +1000,14 @@
zval **str, **delim, **zlimit = NULL;
int limit = -1;
int argc = ZEND_NUM_ARGS();
-
-   if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &delim, &str, 
&zlimit) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|l", &delim, 
&str, &limit) == FAILURE) {
+   return;
}
+   
convert_to_string_ex(str);
convert_to_string_ex(delim);
 
-   if (argc > 2) {
-   convert_to_long_ex(zlimit);
-   limit = Z_LVAL_PP(zlimit);
-   }
-
if (! Z_STRLEN_PP(delim)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
RETURN_FALSE;
@@ -1140,15 +1126,13 @@
 PHP_FUNCTION(implode)

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

2008-05-09 Thread Scott MacVicar
scottmacFri May  9 12:59:16 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  MFH: Fix compile error if _GNU_SOURCE is defined
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.20&r2=1.445.2.14.2.69.2.21&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.20 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.21
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.20  Tue Apr 29 08:15:20 2008
+++ php-src/ext/standard/string.c   Fri May  9 12:59:16 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.20 2008/04/29 08:15:20 dmitry Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.21 2008/05/09 12:59:16 scottmac Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -414,14 +414,12 @@
 #endif
 #ifdef DECIMAL_POINT
REGISTER_NL_LANGINFO_CONSTANT(DECIMAL_POINT);
-#endif
-#ifdef RADIXCHAR
+#elif defined(RADIXCHAR)
REGISTER_NL_LANGINFO_CONSTANT(RADIXCHAR);
 #endif
 #ifdef THOUSANDS_SEP
REGISTER_NL_LANGINFO_CONSTANT(THOUSANDS_SEP);
-#endif
-#ifdef THOUSEP
+#elif defined(THOUSEP)
REGISTER_NL_LANGINFO_CONSTANT(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(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings substr.phpt substr_compare.phpt

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

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings substr.phpt substr_compare.phpt 
  Log:
  MFH: Fix inconcistencies between substr and substr_compare
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.16&r2=1.445.2.14.2.69.2.17&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.16 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.17
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.16  Tue Feb 12 00:21:15 2008
+++ php-src/ext/standard/string.c   Wed Feb 13 17:02:15 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.16 2008/02/12 00:21:15 stas Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.17 2008/02/13 17:02:15 colder Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2172,8 +2172,10 @@
}

f = Z_LVAL_PP(from);
-   if (f > Z_STRLEN_PP(str) || (f < 0 && -f > Z_STRLEN_PP(str))) {
+   if (f > Z_STRLEN_PP(str)) {
RETURN_FALSE;
+   } else if (f < 0 && -f > Z_STRLEN_PP(str)) {
+   f = 0;
}
 
if (l < 0 && (l + Z_STRLEN_PP(str) - f) < 0) {
@@ -5245,14 +5247,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 length cannot 
exceed initial 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.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/strings/substr.phpt
diff -u php-src/ext/standard/tests/strings/substr.phpt:1.1.2.1 
php-src/ext/standard/tests/strings/substr.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/strings/substr.phpt:1.1.2.1  Sat May 12 
10:15:02 2007
+++ php-src/ext/standard/tests/strings/substr.phpt  Wed Feb 13 17:02:16 2008
@@ -72,6 +72,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";
 
@@ -215,4 +219,7 @@
 *** Testing for string with international characters ***
 string(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.1.2.2.2.1&r2=1.1.2.2.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/strings/substr_compare.phpt
diff -u php-src/ext/standard/tests/strings/substr_compare.phpt:1.1.2.2.2.1 
php-src/ext/standard/tests/strings/substr_compare.phpt:1.1.2.2.2.1.2.1
--- php-src/ext/standard/tests/strings/substr_compare.phpt:1.1.2.2.2.1  Fri Mar 
 9 09:45:14 2007
+++ php-src/ext/standard/tests/strings/substr_compare.phpt  Wed Feb 13 
17:02:16 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 length cannot exceed initial 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(PHP_5_3) /ext/standard string.c

2008-02-11 Thread Stanislav Malyshev
stasTue Feb 12 00:21:15 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  [DOC] Add compile-time __DIR__ constant which implements dirname(__FILE__)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.15&r2=1.445.2.14.2.69.2.16&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.15 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.16
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.15  Sun Feb  3 14:30:25 2008
+++ php-src/ext/standard/string.c   Tue Feb 12 00:21:15 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.15 2008/02/03 14:30:25 felipe Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.16 2008/02/12 00:21:15 stas Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1444,94 +1444,7 @@
Returns directory name component of path */
 PHPAPI size_t php_dirname(char *path, size_t 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 after :
-* increment the len_adjust to the length of path till colon 
character(inclusive)
-* If there is no character beyond : simple return len
-*/
-   char *colonpos = NULL;
-   colonpos = strchr(path, ':');
-   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_SLASH_P(end)) {
-   end--;
-   }
-   if (end < path) {
-   /* The path only contained slashes */
-   path[0] = DEFAULT_SLASH;
-   path[1] = '\0';
-   return 1 + len_adjust;
-   }
-
-   /* Strip filename */
-   while (end >= path && !IS_SLASH_P(end)) {
-   end--;
-   }
-   if (end < path) {
-   /* No slash found, therefore return '.' */
-#ifdef NETWARE
-   if(len_adjust == 0) {
-   path[0] = '.';
-   path[1] = '\0';
-   return 1; //only one character
-   } 
-   else {
-   path[0] = '\0';
-   return len_adjust;
-   }
-#else
-   path[0] = '.';
-   path[1] = '\0';
-   return 1 + len_adjust;
-#endif
-   }
-
-   /* Strip slashes which came before the file name */
-   while (end >= path && IS_SLASH_P(end)) {
-   end--;
-   }
-   if (end < path) {
-   path[0] = DEFAULT_SLASH;
-   path[1] = '\0';
-   return 1 + len_adjust;
-   }
-   *(end+1) = '\0';
-
-   return (size_t)(end + 1 - path) + len_adjust;
+   return zend_dirname(path, len);
 }
 /* }}} */
 

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



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

2008-02-03 Thread Felipe Pena
felipe  Sun Feb  3 14:30:25 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  Fixed reference problem (variable were converted)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.14&r2=1.445.2.14.2.69.2.15&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.14 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.15
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.14  Fri Feb  1 12:28:43 2008
+++ php-src/ext/standard/string.c   Sun Feb  3 14:30:25 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.14 2008/02/01 12:28:43 felipe Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.15 2008/02/03 14:30:25 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1702,10 +1702,8 @@
return;
}
 
-   SEPARATE_ZVAL(haystack);
-   SEPARATE_ZVAL(needle);
-   
-   convert_to_string_ex(haystack);
+   SEPARATE_ZVAL(haystack);
+   convert_to_string(*haystack);
 
haystack_orig = estrndup(Z_STRVAL_PP(haystack), Z_STRLEN_PP(haystack));
 
@@ -1716,19 +1714,14 @@
RETURN_FALSE;
}
 
-   found = php_stristr(Z_STRVAL_PP(haystack),
-   Z_STRVAL_PP(needle),
-   Z_STRLEN_PP(haystack),
-   Z_STRLEN_PP(needle));
+   found = php_stristr(Z_STRVAL_PP(haystack), Z_STRVAL_PP(needle), 
Z_STRLEN_PP(haystack), Z_STRLEN_PP(needle));
} else {
-   convert_to_long_ex(needle);
+   SEPARATE_ZVAL(needle);
+   convert_to_long(*needle);
needle_char[0] = (char) Z_LVAL_PP(needle);
needle_char[1] = 0;
 
-   found = php_stristr(Z_STRVAL_PP(haystack),
-   needle_char,
-   Z_STRLEN_PP(haystack),
-   1);
+   found = php_stristr(Z_STRVAL_PP(haystack), needle_char, 
Z_STRLEN_PP(haystack), 1);
}
 
if (found) {
@@ -1760,7 +1753,8 @@
return;
}
 
-   convert_to_string_ex(haystack);
+   SEPARATE_ZVAL(haystack);
+   convert_to_string(*haystack);
 
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
@@ -1768,19 +1762,14 @@
RETURN_FALSE;
}
 
-   found = php_memnstr(Z_STRVAL_PP(haystack), 
-   Z_STRVAL_PP(needle),
-   Z_STRLEN_PP(needle), 
-   Z_STRVAL_PP(haystack) + 
Z_STRLEN_PP(haystack));
+   found = php_memnstr(Z_STRVAL_PP(haystack), Z_STRVAL_PP(needle), 
Z_STRLEN_PP(needle), Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
} else {
-   convert_to_long_ex(needle);
+   SEPARATE_ZVAL(needle);
+   convert_to_long(*needle);
needle_char[0] = (char) Z_LVAL_PP(needle);
needle_char[1] = 0;
 
-   found = php_memnstr(Z_STRVAL_PP(haystack), 
-   needle_char,
-   1,
-   Z_STRVAL_PP(haystack) + 
Z_STRLEN_PP(haystack));
+   found = php_memnstr(Z_STRVAL_PP(haystack), needle_char, 1, 
Z_STRVAL_PP(haystack) + Z_STRLEN_PP(haystack));
}
 
if (found) {
@@ -1790,9 +1779,8 @@
} else {
RETURN_STRINGL(found, Z_STRLEN_PP(haystack) - 
found_offset, 1);
}
-   } else {
-   RETURN_FALSE;
}
+   RETURN_FALSE;
 }
 /* }}} */
 

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



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

2008-01-25 Thread Hannes Magnusson
On Jan 25, 2008 2:31 AM, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote:
> iliaa   Fri Jan 25 01:31:11 2008 UTC
>
>   Modified files:  (Branch: PHP_5_3)
> /php-src/ext/standard   string.c
>   Log:
>
>   Adjust new chr() param handling to address chr("") calls
>
> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.12&r2=1.445.2.14.2.69.2.13&diff_format=u
> Index: php-src/ext/standard/string.c
> diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.12 
> php-src/ext/standard/string.c:1.445.2.14.2.69.2.13
> --- php-src/ext/standard/string.c:1.445.2.14.2.69.2.12  Tue Jan 22 01:34:24 
> 2008
> +++ php-src/ext/standard/string.c   Fri Jan 25 01:31:10 2008
> @@ -18,7 +18,7 @@
> +--+
>   */
>
> -/* $Id: string.c,v 1.445.2.14.2.69.2.12 2008/01/22 01:34:24 iliaa Exp $ */
> +/* $Id: string.c,v 1.445.2.14.2.69.2.13 2008/01/25 01:31:10 iliaa Exp $ */
>
>  /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
>
> @@ -2604,9 +2604,14 @@
> long c;
> char temp[2];
>
> -   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == 
> FAILURE) {
> -   return;
> +   if (ZEND_NUM_ARGS() != 1) {
> +   WRONG_PARAM_COUNT;
> }
> +
> +   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
> TSRMLS_CC, "l", &c) == FAILURE) {
> +   c = 0;
> +   }

This definitely looks wrong. If I pass an object or whatever it won't
throw any errors.

-Hannes

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



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

2008-01-25 Thread Antony Dovgal
Ilia, the tests are still broken.

On 25.01.2008 04:31, Ilia Alshanetsky wrote:
> iliaa Fri Jan 25 01:31:11 2008 UTC
> 
>   Modified files:  (Branch: PHP_5_3)
> /php-src/ext/standard string.c 
>   Log:
>   
>   Adjust new chr() param handling to address chr("") calls
>   
> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.12&r2=1.445.2.14.2.69.2.13&diff_format=u
> Index: php-src/ext/standard/string.c
> diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.12 
> php-src/ext/standard/string.c:1.445.2.14.2.69.2.13
> --- php-src/ext/standard/string.c:1.445.2.14.2.69.2.12Tue Jan 22 
> 01:34:24 2008
> +++ php-src/ext/standard/string.c Fri Jan 25 01:31:10 2008
> @@ -18,7 +18,7 @@
> +--+
>   */
>  
> -/* $Id: string.c,v 1.445.2.14.2.69.2.12 2008/01/22 01:34:24 iliaa Exp $ */
> +/* $Id: string.c,v 1.445.2.14.2.69.2.13 2008/01/25 01:31:10 iliaa Exp $ */
>  
>  /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
>  
> @@ -2604,9 +2604,14 @@
>   long c;
>   char temp[2];
>  
> - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == 
> FAILURE) {
> - return;
> + if (ZEND_NUM_ARGS() != 1) {
> + WRONG_PARAM_COUNT;
>   }
> +
> + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
> TSRMLS_CC, "l", &c) == FAILURE) {
> + c = 0;
> + }
> +
>   temp[0] = (char)c;
>   temp[1] = '\0';
>  
> 


-- 
Wbr, 
Antony Dovgal

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



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

2008-01-24 Thread Ilia Alshanetsky
iliaa   Fri Jan 25 01:31:11 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  
  Adjust new chr() param handling to address chr("") calls
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.12&r2=1.445.2.14.2.69.2.13&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.12 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.13
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.12  Tue Jan 22 01:34:24 2008
+++ php-src/ext/standard/string.c   Fri Jan 25 01:31:10 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.12 2008/01/22 01:34:24 iliaa Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.13 2008/01/25 01:31:10 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2604,9 +2604,14 @@
long c;
char temp[2];
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == 
FAILURE) {
-   return;
+   if (ZEND_NUM_ARGS() != 1) {
+   WRONG_PARAM_COUNT;
}
+
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, "l", &c) == FAILURE) {
+   c = 0;
+   }
+
temp[0] = (char)c;
temp[1] = '\0';
 

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



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

2008-01-24 Thread Dmitry Stogov

Hi Ilia,

This patch was committed into PHP_5_3 only, and it breaks two tests.
Could you please revert it or fix test files and commit to HEAD.

ext/standard/tests/array/array_filter_variation9.phpt

ext/standard/tests/strings/chr_ord.phpt

Thanks. Dmitry.

Ilia Alshanetsky wrote:

iliaa   Tue Jan 22 01:34:24 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard	string.c 
  Log:

  use new param parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.11&r2=1.445.2.14.2.69.2.12&diff_format=u

Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.11 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.12
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.11  Sat Jan 19 19:27:21 2008
+++ php-src/ext/standard/string.c   Tue Jan 22 01:34:24 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.11 2008/01/19 19:27:21 davidc Exp $ */

+/* $Id: string.c,v 1.445.2.14.2.69.2.12 2008/01/22 01:34:24 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2601,18 +2601,16 @@

Converts ASCII code to a character */
 PHP_FUNCTION(chr)
 {
-   zval **num;
+   long c;
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", &c) == 
FAILURE) {
+   return;
}
-   convert_to_long_ex(num);
-   
-   temp[0] = (char) Z_LVAL_PP(num);
-   temp[1] = 0;
+   temp[0] = (char)c;
+   temp[1] = '\0';
 
-	RETVAL_STRINGL(temp, 1, 1);

+   RETURN_STRINGL(temp, 1, 1);
 }
 /* }}} */
 



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



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

2008-01-21 Thread Ilia Alshanetsky
iliaa   Tue Jan 22 01:34:24 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  use new param parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.11&r2=1.445.2.14.2.69.2.12&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.11 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.12
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.11  Sat Jan 19 19:27:21 2008
+++ php-src/ext/standard/string.c   Tue Jan 22 01:34:24 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.11 2008/01/19 19:27:21 davidc Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.12 2008/01/22 01:34:24 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2601,18 +2601,16 @@
Converts ASCII code to a character */
 PHP_FUNCTION(chr)
 {
-   zval **num;
+   long c;
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", &c) == 
FAILURE) {
+   return;
}
-   convert_to_long_ex(num);
-   
-   temp[0] = (char) Z_LVAL_PP(num);
-   temp[1] = 0;
+   temp[0] = (char)c;
+   temp[1] = '\0';
 
-   RETVAL_STRINGL(temp, 1, 1);
+   RETURN_STRINGL(temp, 1, 1);
 }
 /* }}} */
 

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



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

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

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  MFH: 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.445.2.14.2.69.2.9&r2=1.445.2.14.2.69.2.10&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.9 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.10
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.9   Wed Jan 16 03:11:26 2008
+++ php-src/ext/standard/string.c   Wed Jan 16 08:34:33 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.9 2008/01/16 03:11:26 davidc Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.10 2008/01/16 08:34:33 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -5142,7 +5142,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(PHP_5_3) /ext/standard string.c

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

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  - MFH
  - Making sure this is also using the good zend parsing and added
the php_ucfirst function
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.8&r2=1.445.2.14.2.69.2.9&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.8 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.9
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.8   Mon Dec 31 07:17:15 2007
+++ php-src/ext/standard/string.c   Wed Jan 16 03:11:26 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.8 2007/12/31 07:17:15 sebastian Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.9 2008/01/16 03:11:26 davidc Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2616,23 +2616,33 @@
 }
 /* }}} */
 
+/* {{{ 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);
+}
+/* }}} */
+
 /* {{{ proto string ucfirst(string str)
Makes a string's first character uppercase */
 PHP_FUNCTION(ucfirst)
 {
-   zval **str;
+   char *str;
+   int  str_len;

-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) 
{
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {
+   return;
}
-   convert_to_string_ex(str);
 
-   if (!Z_STRLEN_PP(str)) {
+   if (!str_len) {
RETURN_EMPTY_STRING();
}
 
-   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, str_len, 1);
+   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(PHP_5_3) /ext/standard string.c /ext/standard/tests/strings chunk_split_error.phpt chunk_split_variation5.phpt chunk_split_variation8.phpt htmlspecialchars_decode_variation2.ph

2007-12-24 Thread Dmitry Stogov
dmitry  Mon Dec 24 18:09:50 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/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.208.2.4.2.23.2.4&r2=1.208.2.4.2.23.2.5&diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.4 
ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.5
--- ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.4 Mon Dec 17 10:02:13 2007
+++ ZendEngine2/zend_operators.cMon Dec 24 18:09:50 2007
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.4 2007/12/17 10:02:13 dmitry Exp $ 
*/
+/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.5 2007/12/24 18:09:50 dmitry Exp $ 
*/
 
 #include 
 
@@ -186,36 +186,38 @@
 #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
 
+
 #define zendi_convert_to_long(op, holder, result)  
\
if (op == result) { 
\
convert_to_long(op);
\
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/int_overflow_64bit.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: ZendEngine2/tests/int_overflow_64bit.phpt
diff -u ZendEngine2/tests/int_overflow_64bit.phpt:1.1.2.1 
ZendEngine2/tests/int_overflow_64bit.phpt:1.1.2.1.2.1
--- ZendEngine2/tests/int_overflow_64bit.phpt:1.1.2.1   Thu Sep 28 12:03:49 2006
+++ ZendEngine2/tests/int_overflow_64bit.phpt   Mon Dec 24 18:09:50 2007
@@ -6,11 +6,13 @@
 
 --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.445.2.14.2.69.2.6&r2=1.445.2.14.2.69.2.7&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.6 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.7
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.6   Thu Dec 13 22:29:48 2007
+++ php-src/ext/standard/string.c   Mon Dec 24 18:09:50 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.6 2007/12/13 22:29:48 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.7 2007/12/24 18:09:50 dmitry Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2182,12 +2182,12 @@
char *result;
char *end= "\r\n

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

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

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  MFH: add workaround for glibc issue
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.5&r2=1.445.2.14.2.69.2.6&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.5 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.6
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.5   Sun Oct  7 05:22:07 2007
+++ php-src/ext/standard/string.c   Thu Dec 13 22:29:48 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.5 2007/10/07 05:22:07 davidw Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.6 2007/12/13 22:29:48 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -451,15 +451,182 @@
Query language and locale information */
 PHP_FUNCTION(nl_langinfo)
 {
-   zval **item;
+   long item;
char *value;

-   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &item) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == 
FAILURE) {
+   return;
+   }
+
+   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 

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

2007-10-01 Thread Jani Taskinen
janiMon Oct  1 13:38:15 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  - ws + cs + sync HEAD
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.2&r2=1.445.2.14.2.69.2.3&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.2 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.3
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.2   Mon Oct  1 12:05:41 2007
+++ php-src/ext/standard/string.c   Mon Oct  1 13:38:14 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.2 2007/10/01 12:05:41 jani Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.3 2007/10/01 13:38:14 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2181,8 +2181,7 @@
 
if (Z_TYPE_PP(str) == IS_STRING) {
if (
-   (argc == 3 && Z_TYPE_PP(from) == IS_ARRAY) 
-   || 
+   (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 ");
@@ -2195,7 +2194,6 @@
}
}
}
-

if (Z_TYPE_PP(str) != IS_ARRAY) {
if (Z_TYPE_PP(from) != IS_ARRAY) {
@@ -5127,12 +5125,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 length cannot 
exceed initial 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(PHP_5_3) /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:05:41 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
/php-src/ext/standard/tests/strings implode1.phpt join_error.phpt 
join_variation2.phpt 
  Log:
  MFH: Fixed bug #42789
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69.2.1&r2=1.445.2.14.2.69.2.2&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.1 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.2
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.1   Sun Sep 30 05:40:23 2007
+++ php-src/ext/standard/string.c   Mon Oct  1 12:05:41 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.1 2007/09/30 05:40:23 jani Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.2 2007/10/01 12:05:41 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -988,7 +988,7 @@
 
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");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument 
must be an array");
return;
}
 
@@ -1008,7 +1008,7 @@
convert_to_string_ex(arg1);
delim = *arg1;
} else {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad 
arguments");
+   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.1.2.4.2.1&r2=1.1.2.4.2.2&diff_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.1.4.3&r2=1.1.4.4&diff_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.4.3 
php-src/ext/standard/tests/strings/join_error.phpt:1.1.4.4
--- php-src/ext/standard/tests/strings/join_error.phpt:1.1.4.3  Sun Sep 30 
14:37:33 2007
+++ php-src/ext/standard/tests/strings/join_error.phpt  Mon Oct  1 12:05:41 2007
@@ -1,5 +1,5 @@
 --TEST--
-Test join() function : error conditions(Bug#42789) 
+Test join() function: error conditions
 --FILE--
 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/join_variation2.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_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.4.2 
php-src/ext/standard/tests/strings/join_variation2.phpt:1.1.4.3
--- php-src/ext/standard/tests/strings/join_variation2.phpt:1.1.4.2 Sat Sep 
29 16:52:54 2007
+++ php-src/ext/standard/tests/strings/join_variation2.phpt Mon Oct  1 
12:05:41 2007
@@ -105,94 +105,94 @@
 --- 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 %d
 NULL
 -- Iteration 9 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 10 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 11 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 12 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 13 --
 
-Warning: join(): Bad arguments in %s on line %d
+Warning: join(): Invalid arguments passed in %s on line %d
 NULL
 -- Iteration 14 --
 
-Warning: join(): Bad arguments in %s on 

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

2007-09-29 Thread Jani Taskinen
janiSun Sep 30 05:40:24 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/standard   string.c 
  Log:
  - Nuked ending dots from error messages
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.69&r2=1.445.2.14.2.69.2.1&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.1
--- php-src/ext/standard/string.c:1.445.2.14.2.69   Fri Sep  7 18:23:58 2007
+++ php-src/ext/standard/string.c   Sun Sep 30 05:40:23 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69 2007/09/07 18:23:58 pajoye Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.1 2007/09/30 05:40:23 jani Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -511,22 +511,22 @@
/* Error, try to be as helpful as possible:
   (a range ending/starting with '.' won't be captured 
here) */
if (end-len >= input) { /* there was no 'left' char */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid '..'-range, no character to the left of '..'.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid '..'-range, no character to the left of '..'");
result = FAILURE;
continue;
}
if (input+2 >= end) { /* there is no 'right' char */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid '..'-range, no character to the right of '..'.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid '..'-range, no character to the right of '..'");
result = FAILURE;
continue;
}
if (input[-1] > input[2]) { /* wrong order */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid '..'-range, '..'-range needs to be incrementing.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid '..'-range, '..'-range needs to be incrementing");
result = FAILURE;
continue;
} 
/* FIXME: better error (a..b..c is the only left 
possibility?) */
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
'..'-range.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
'..'-range");
result = FAILURE;
continue;
} else {
@@ -861,7 +861,7 @@
}
 
if (! Z_STRLEN_PP(delim)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter");
RETURN_FALSE;
}
 
@@ -988,7 +988,7 @@
 
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.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument 
to implode must be an array");
return;
}
 
@@ -1008,7 +1008,7 @@
convert_to_string_ex(arg1);
delim = *arg1;
} else {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad 
arguments.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad 
arguments");
return;
}
}
@@ -1544,7 +1544,7 @@
 
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty 
delimiter.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty 
delimiter");
efree(haystack_orig);
RETURN_FALSE;
}
@@ -1592,7 +1592,7 @@
 
if (Z_TYPE_PP(needle) == IS_STRING) {
if (!Z_STRLEN_PP(needle)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty 
delimiter.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty 
delimiter");
RETURN_FALSE;
}
 
@@ -1645,13 +1645,13 @@
}
 
if (offset < 0 || offset > Z_STRLEN_PP(haystack)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not 
contained in string.");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not 
contained in string");
RETURN_FALSE;
}
 
if (Z_TYPE_PP(needle) == IS_STRING) {