cvs: /php4/ext/standard string.c

From: Date: Thu, 30 Mar 2000 14:35:16 +0000
Subject: cvs: /php4/ext/standard string.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-12878@lists.php.net to get a copy of this message
andrei Thu Mar 30 06:35:16 2000 EDT Modified files: /php4/ext/standard string.c Log: @- Fixed return of stristr() to no longer always be lowercased. (Andrei) Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.104 php4/ext/standard/string.c:1.105 --- php4/ext/standard/string.c:1.104 Sun Mar 26 09:06:19 2000 +++ php4/ext/standard/string.c Thu Mar 30 06:34:46 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.104 2000/03/26 17:06:19 zeev Exp $ */ +/* $Id: string.c,v 1.105 2000/03/30 14:34:46 andrei Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -573,6 +573,8 @@ { zval **haystack, **needle; char *found = NULL; + int found_offset; + char *haystack_orig; char needle_char[2]; if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &haystack, &needle) == @@ -583,10 +585,13 @@ SEPARATE_ZVAL(haystack); SEPARATE_ZVAL(needle); convert_to_string_ex(haystack); + haystack_orig = estrndup((*haystack)->value.str.val, + (*haystack)->value.str.len); if ((*needle)->type == IS_STRING) { if ((*needle)->value.str.len==0) { php_error(E_WARNING,"Empty delimiter"); + efree(haystack_orig); RETURN_FALSE; } @@ -602,10 +607,13 @@ } if (found) { - RETVAL_STRING(found, 1); + found_offset = found - (*haystack)->value.str.val; + RETVAL_STRINGL(haystack_orig + found_offset, + (*haystack)->value.str.len - found_offset, 1); } else { RETVAL_FALSE; } + efree(haystack_orig); } /* }}} */

« previous php.version4 (#12878) next »