summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/string.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 3426a4bf85..7614b78745 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2148,7 +2148,7 @@ PHP_FUNCTION(parse_str)
*/
int php_tag_find(char *tag, int len, char *set) {
char c, *n, *t;
- int i=0, state=0, done=0;
+ int state=0, done=0;
char *norm = emalloc(len+1);
n = norm;
@@ -2159,7 +2159,10 @@ int php_tag_find(char *tag, int len, char *set) {
and turn any <a whatever...> into just <a> and any </tag>
into <tag>
*/
- while(i<len && !done) {
+ if (!len) {
+ return 0;
+ }
+ while(!done) {
switch(c) {
case '<':
*(n++) = c;