iliaa           Wed Oct 11 14:30:50 2006 UTC

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

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

Reply via email to