Req #67386 [Opn]: wrong assignment in mbfl_identify_encoding2

From: Date: Sat, 05 Jul 2014 23:08:22 +0000
Subject: Req #67386 [Opn]: wrong assignment in mbfl_identify_encoding2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186477@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67386&edit=1 ID: 67386 Updated by: yohgaki@php.net Reported by: delda at virgilio dot it Summary: wrong assignment in mbfl_identify_encoding2 Status: Open Type: Feature/Change Request Package: mbstring related Operating System: All PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Could you send patch rather than whole file? or pull request? Previous Comments: ------------------------------------------------------------------------ [2014-06-05 13:43:54] delda at virgilio dot it Description: ------------ I think that in the function 'mbfl_identify_encoding2' (in ext/mbstring/libmbfl/mbfl/mbfilter.c), the variable 'bad' was instantiated in a wrong place. The same is in 'mbfl_encoding_detector_feed' and 'mbfl_identify_encoding' Test script: --------------- if (p != NULL) { bad = 0; while (n > 0) { for (i = 0; i < num; i++) { [...] } if ((num - 1) <= bad && !strict) { break; } p++; n--; } } I think that 'bad' variable must be inner the while cycle, otherwise the if control on bad number detect is very poor. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67386&edit=1

« previous php.bugs (#186477) next »