|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42532 strncmp() output differs with and without Unicode
Submitted: 2007-09-03 13:24 UTC Modified: 2007-09-07 13:19 UTC
From: mahesh dot vemula at in dot ibm dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 6CVS-2007-09-03 (CVS) OS: RHEL4
Private report: No CVE-ID: None
 [2007-09-03 13:24 UTC] mahesh dot vemula at in dot ibm dot com
strncmp() of a regular string(as first argument) with an empty string, returns an integer value of difference in their length when Unicode is OFF, and returns int(+1) when the Unicode is ON.  
Is this the expected behavior according to documentation, which says strncmp() returns >0 or <0 when two strings are not equal. Or Could output be consistent with and without Unicode?

Reproduce code:
var_dump( strncmp("Hello", "", 10) );


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-07 13:19 UTC] mahesh dot vemula at in dot ibm dot com
The output is valid and expected.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Aug 06 08:01:26 2020 UTC