andrey          Wed Oct  2 14:41:55 2002 EDT

  Modified files:              
    /php4/ext/standard  string.c 
  Log:
  Making strstr() binary safe.
  
  
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.302 php4/ext/standard/string.c:1.303
--- php4/ext/standard/string.c:1.302    Wed Oct  2 14:13:56 2002
+++ php4/ext/standard/string.c  Wed Oct  2 14:41:55 2002
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.302 2002/10/02 18:13:56 andrey Exp $ */
+/* $Id: string.c,v 1.303 2002/10/02 18:41:55 andrey Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1360,6 +1360,7 @@
        zval **haystack, **needle;
        char *found = NULL;
        char needle_char[2];
+       long found_offset;
        
        if (ZEND_NUM_ARGS() != 2 || 
                zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
@@ -1387,7 +1388,8 @@
        }
 
        if (found) {
-               RETURN_STRING(found, 1);
+               found_offset = found - Z_STRVAL_PP(haystack);
+               RETURN_STRINGL(found, Z_STRLEN_PP(haystack) - found_offset, 1);
        } else {
                RETURN_FALSE;
        }



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

Reply via email to