diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2009-04-01 14:00:38 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2009-04-01 14:00:38 +0000 |
| commit | e1cb53f5ec8be62b9d95372cc253a136682e29c8 (patch) | |
| tree | fb6ddc90c4c549a32ee1943ec2319c517fa017e7 /ext | |
| parent | 4bccb4565d6829b772eb84c087723e60d8f4eae5 (diff) | |
| download | php-git-e1cb53f5ec8be62b9d95372cc253a136682e29c8.tar.gz | |
Fixed bug #47856 (stristr() converts needle to lower-case).
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/standard/string.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 458cd4d3ac..61a6fbf622 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1595,13 +1595,15 @@ PHP_FUNCTION(stristr) haystack_orig = estrndup(Z_STRVAL_PP(haystack), Z_STRLEN_PP(haystack)); if (Z_TYPE_PP(needle) == IS_STRING) { + char *orig_needle; if (!Z_STRLEN_PP(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty delimiter"); efree(haystack_orig); RETURN_FALSE; } - - found = php_stristr(Z_STRVAL_PP(haystack), Z_STRVAL_PP(needle), Z_STRLEN_PP(haystack), Z_STRLEN_PP(needle)); + orig_needle = estrndup(Z_STRVAL_PP(needle), Z_STRLEN_PP(needle)); + found = php_stristr(Z_STRVAL_PP(haystack), orig_needle, Z_STRLEN_PP(haystack), Z_STRLEN_PP(needle)); + efree(orig_needle); } else { SEPARATE_ZVAL(needle); convert_to_long(*needle); |
