iliaa           Wed Nov 15 18:35:18 2006 UTC

  Modified files:              
    /php-src/ext/iconv  iconv.c 
    /php-src/ext/iconv/tests    bug37773.phpt 
  Log:
  MFB: Fixed bug #37773 (iconv_substr() gives "Unknown error" when string
  length = 1").
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.146&r2=1.147&diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.146 php-src/ext/iconv/iconv.c:1.147
--- php-src/ext/iconv/iconv.c:1.146     Sun Oct  8 13:34:22 2006
+++ php-src/ext/iconv/iconv.c   Wed Nov 15 18:35:18 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: iconv.c,v 1.146 2006/10/08 13:34:22 bjori Exp $ */
+/* $Id: iconv.c,v 1.147 2006/11/15 18:35:18 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -809,7 +809,9 @@
                                }
                        }
 
-                       _php_iconv_appendl(pretval, buf, sizeof(buf), cd2);
+                       if (_php_iconv_appendl(pretval, buf, sizeof(buf), cd2) 
!= PHP_ICONV_ERR_SUCCESS) {
+                               break;
+                       }
                        --len;
                }
 
@@ -827,10 +829,6 @@
 
                case E2BIG:
                        break;
-
-               default:
-                       err = PHP_ICONV_ERR_UNKNOWN;
-                       break;
        }
 #endif
        if (err == PHP_ICONV_ERR_SUCCESS) {
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/tests/bug37773.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/iconv/tests/bug37773.phpt
diff -u /dev/null php-src/ext/iconv/tests/bug37773.phpt:1.2
--- /dev/null   Wed Nov 15 18:35:18 2006
+++ php-src/ext/iconv/tests/bug37773.phpt       Wed Nov 15 18:35:18 2006
@@ -0,0 +1,10 @@
+--TEST--
+Bug #37773 (iconv_substr() gives "Unknown error" when string length = 1")
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+       var_dump(iconv_substr('x', 0, 1, 'UTF-8'));
+?>
+--EXPECT--
+string(1) "x"
\ No newline at end of file

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

Reply via email to