php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43750 stristr modifies strings
Submitted: 2008-01-04 16:12 UTC Modified: 2008-01-10 14:31 UTC
From: samuel at slbdata dot se Assigned:
Status: Closed Package: Strings related
PHP Version: 6CVS-2008-01-04 (snap) OS: Ubuntu 7.10
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: samuel at slbdata dot se
New email:
PHP Version: OS:

 

 [2008-01-04 16:12 UTC] samuel at slbdata dot se
Description:
------------
stristr converts it's parameters to lower case (non-ASCII characters are not changed though). This happens with php6.0-200801022130 and php6.0-200801041530 and the locale set to sv_SE.UTF-8

This might be a regression of bug #3890


Reproduce code:
---------------
<?php
  
$a = "ABC???";
$b = "PHP";

stristr($a, $b);

echo "$a\n$b\n";


Expected result:
----------------
ABC???
PHP

Actual result:
--------------
abc???
php


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-08 11:37 UTC] felipe@php.net
Index: string.c
===================================================================
RCS file: /repository/php-src/ext/standard/string.c,v
retrieving revision 1.659
diff -u -u -r1.659 string.c
--- string.c    31 Dec 2007 07:12:16 -0000      1.659
+++ string.c    8 Jan 2008 11:33:56 -0000
@@ -2526,6 +2526,9 @@
                return;
        }
 
+       SEPARATE_ZVAL(haystack);
+       SEPARATE_ZVAL(needle);
+
        if (Z_TYPE_PP(haystack) != IS_UNICODE && Z_TYPE_PP(haystack) != IS_STRING) {
                convert_to_text_ex(haystack);
        }

 [2008-01-08 14:25 UTC] samuel at slbdata dot se
It works correctly with your patch.

Thank you!
 [2008-01-10 14:31 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC