Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c branches/PHP_5_4/ext/intl/tests/bug55562.phpt trunk/ext/intl/grapheme/grapheme_string.c trunk/ext/intl/tests/bug55

2011-09-04 Thread Stas Malyshev
Hi!

On 9/4/11 2:44 PM, Pierre Joye wrote:
> 5.3?

It changes the API (even though old one is wrong IMO) so I'm not sure if
it belongs there. Up to 5.3 RM.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c branches/PHP_5_4/ext/intl/tests/bug55562.phpt trunk/ext/intl/grapheme/grapheme_string.c trunk/ext/intl/tests/bug55

2011-09-04 Thread Pierre Joye
5.3?

On Sun, Sep 4, 2011 at 8:50 PM, Stanislav Malyshev  wrote:
> stas Sun, 04 Sep 2011 18:50:05 +
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=316113
>
> Log:
> fix bug 55562 - make substr always return rest of the string if length is too 
> long
>
> Bug: https://bugs.php.net/55562 (Assigned) grapheme_substr() returns false if 
> length parameter is to large
>
> Changed paths:
>U   php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
>A   php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt
>U   php/php-src/trunk/ext/intl/grapheme/grapheme_string.c
>A   php/php-src/trunk/ext/intl/tests/bug55562.phpt
>
> Modified: php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
> ===
> --- php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
> 2011-09-04 16:33:51 UTC (rev 316112)
> +++ php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
> 2011-09-04 18:50:05 UTC (rev 316113)
> @@ -554,13 +554,17 @@
>length += iter_val;
>}
>
> -   if ( UBRK_DONE == sub_str_end_pos && length < 0) {
> +   if ( UBRK_DONE == sub_str_end_pos) {
> +   if(length < 0) {
>
> -   intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
> "grapheme_substr: length not contained in string", 1 TSRMLS_CC );
> +   intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
> "grapheme_substr: length not contained in string", 1 TSRMLS_CC );
>
> -   efree(ustr);
> -   ubrk_close(bi);
> -   RETURN_FALSE;
> +   efree(ustr);
> +   ubrk_close(bi);
> +   RETURN_FALSE;
> +   } else {
> +   sub_str_end_pos = ustr_len;
> +   }
>}
>
>sub_str = NULL;
>
> Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt
> ===
> --- php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt 
>   (rev 0)
> +++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt   2011-09-04 
> 18:50:05 UTC (rev 316113)
> @@ -0,0 +1,13 @@
> +--TEST--
> +grapheme_substr() - Bug55562 - grapheme_substr() returns false if length 
> parameter is to large
> +--SKIPIF--
> +
> +--FILE--
> + +var_dump(
> +  grapheme_substr('FOK', 1, 20), // expected: OK
> +  grapheme_substr('한국어', 1, 20) //expected: 국어
> +);
> +--EXPECT--
> +string(2) "OK"
> +string(6) "국어"
>
> Modified: php/php-src/trunk/ext/intl/grapheme/grapheme_string.c
> ===
> --- php/php-src/trunk/ext/intl/grapheme/grapheme_string.c   2011-09-04 
> 16:33:51 UTC (rev 316112)
> +++ php/php-src/trunk/ext/intl/grapheme/grapheme_string.c   2011-09-04 
> 18:50:05 UTC (rev 316113)
> @@ -554,13 +554,17 @@
>length += iter_val;
>}
>
> -   if ( UBRK_DONE == sub_str_end_pos && length < 0) {
> +   if ( UBRK_DONE == sub_str_end_pos) {
> +   if(length < 0) {
>
> -   intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
> "grapheme_substr: length not contained in string", 1 TSRMLS_CC );
> +   intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
> "grapheme_substr: length not contained in string", 1 TSRMLS_CC );
>
> -   efree(ustr);
> -   ubrk_close(bi);
> -   RETURN_FALSE;
> +   efree(ustr);
> +   ubrk_close(bi);
> +   RETURN_FALSE;
> +   } else {
> +   sub_str_end_pos = ustr_len;
> +   }
>}
>
>sub_str = NULL;
>
> Added: php/php-src/trunk/ext/intl/tests/bug55562.phpt
> ===
> --- php/php-src/trunk/ext/intl/tests/bug55562.phpt
>   (rev 0)
> +++ php/php-src/trunk/ext/intl/tests/bug55562.phpt  2011-09-04 18:50:05 
> UTC (rev 316113)
> @@ -0,0 +1,13 @@
> +--TEST--
> +grapheme_substr() - Bug55562 - grapheme_substr() returns false if length 
> parameter is to large
> +--SKIPIF--
> +
> +--FILE--
> + +var_dump(
> +  grapheme_substr('FOK', 1, 20), // expected: OK
> +  grapheme_substr('한국어', 1, 20) //expected: 국어
> +);
> +--EXPECT--
> +string(2) "OK"
> +string(6) "국어"
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c branches/PHP_5_4/ext/intl/tests/bug55562.phpt trunk/ext/intl/grapheme/grapheme_string.c trunk/ext/intl/tests/bug55562.

2011-09-04 Thread Stanislav Malyshev
stas Sun, 04 Sep 2011 18:50:05 +

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

Log:
fix bug 55562 - make substr always return rest of the string if length is too 
long

Bug: https://bugs.php.net/55562 (Assigned) grapheme_substr() returns false if 
length parameter is to large
  
Changed paths:
U   php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
A   php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt
U   php/php-src/trunk/ext/intl/grapheme/grapheme_string.c
A   php/php-src/trunk/ext/intl/tests/bug55562.phpt

Modified: php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
===
--- php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
2011-09-04 16:33:51 UTC (rev 316112)
+++ php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
2011-09-04 18:50:05 UTC (rev 316113)
@@ -554,13 +554,17 @@
length += iter_val;
}

-   if ( UBRK_DONE == sub_str_end_pos && length < 0) {
+   if ( UBRK_DONE == sub_str_end_pos) {
+   if(length < 0) {

-   intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
"grapheme_substr: length not contained in string", 1 TSRMLS_CC );
+   intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, 
"grapheme_substr: length not contained in string", 1 TSRMLS_CC );

-   efree(ustr);
-   ubrk_close(bi);
-   RETURN_FALSE;
+   efree(ustr);
+   ubrk_close(bi);
+   RETURN_FALSE;
+   } else {
+   sub_str_end_pos = ustr_len;
+   }
}

sub_str = NULL;

Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt
===
--- php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt   
(rev 0)
+++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug55562.phpt   2011-09-04 
18:50:05 UTC (rev 316113)
@@ -0,0 +1,13 @@
+--TEST--
+grapheme_substr() - Bug55562 - grapheme_substr() returns false if length 
parameter is to large
+--SKIPIF--
+
+--FILE--
+
+--FILE--
+-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/intl/grapheme/ grapheme_string.c

2011-08-07 Thread Gwynne Raskind
gwynne   Sun, 07 Aug 2011 15:09:42 +

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

Log:
fix for bug #55019

Bug: https://bugs.php.net/55019 (Assigned) undefined symbol: 
grapheme_extract_count_iter in Unknown on line 0 
  
Changed paths:
U   php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c

Modified: php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
===
--- php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
2011-08-07 15:07:53 UTC (rev 314431)
+++ php/php-src/branches/PHP_5_4/ext/intl/grapheme/grapheme_string.c
2011-08-07 15:09:42 UTC (rev 314432)
@@ -677,7 +677,7 @@
 /* }}} */

 /* {{{ grapheme_extract_charcount_iter - grapheme iterator for 
grapheme_extract MAXCHARS */
-inline int32_t
+static inline int32_t
 grapheme_extract_charcount_iter(UBreakIterator *bi, int32_t csize, unsigned 
char *pstr, int32_t str_len)
 {
int pos = 0, prev_pos = 0;
@@ -714,7 +714,7 @@
 /* }}} */

 /* {{{ grapheme_extract_bytecount_iter - grapheme iterator for 
grapheme_extract MAXBYTES */
-inline int32_t
+static inline int32_t
 grapheme_extract_bytecount_iter(UBreakIterator *bi, int32_t bsize, unsigned 
char *pstr, int32_t str_len)
 {
int pos = 0, prev_pos = 0;
@@ -748,7 +748,7 @@
 /* }}} */

 /* {{{ grapheme_extract_count_iter - grapheme iterator for grapheme_extract 
COUNT */
-inline int32_t
+static inline int32_t
 grapheme_extract_count_iter(UBreakIterator *bi, int32_t size, unsigned char 
*pstr, int32_t str_len)
 {
int pos = 0, next_pos = 0;

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