php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mahesh dot vemula at in dot ibm dot com
New email:
PHP Version: OS:

 

 [2007-09-03 13:24 UTC] mahesh dot vemula at in dot ibm dot com
Description:
------------
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:
---------------
--TEST--
--FILE--
<?php
var_dump( strncmp("Hello", "", 10) );
?>
--EXPECTF--





Patches

Pull Requests

History

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 10:01:28 2024 UTC