php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44438 stristr will not take 3rd bool arg
Submitted: 2008-03-14 20:56 UTC Modified: 2008-03-17 22:03 UTC
From: jakem at nittanytravel dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.5 OS: windows
Private report: No CVE-ID: None
 [2008-03-14 20:56 UTC] jakem at nittanytravel dot com
Description:
------------
Getting this:

Warning:  Wrong parameter count for stristr() in C:\Inetpub\wwwroot\RCC\test.php on line 39

This line:

     if ($t1 = stristr($file, 'front', true))


Removing true allows function to work.



PHP Version 5.2.5 
System  Windows NT DESKTOP 5.1 build 2600  Build Date  Nov 8 2007 23:18:08  Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"  Server API  ISAPI  Virtual Directory Support  enabled  Configuration File (php.ini) Path  C:\WINDOWS  Loaded Configuration File  C:\WINDOWS\php.ini  PHP API  20041225  PHP Extension  20060613  Zend Extension  220060519  Debug Build  no  Thread Safety  enabled  Zend Memory Manager  enabled  IPv6 Support  enabled  Registered PHP Streams  php, file, data, http, ftp, compress.zlib  Registered Stream Socket Transports  tcp, udp  Registered Stream Filters  convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*  

Reproduce code:
---------------
$file = 'Vienna Front View.jpg';

     if ($t1 = stristr($file, 'front', true))

Expected result:
----------------
Vienna 

Actual result:
--------------
Warning:  Wrong parameter count for stristr() in C:\Inetpub\wwwroot\RCC\test.php on line 39


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-14 21:50 UTC] felipe@php.net
Says the documentation:
"5.3.0 Added the optional parameter before_needle"

This is valid for strstr and stristr.
 [2008-03-15 05:33 UTC] jakem at nittanytravel dot com
where does it say this was added in 5.3?
According to the function page on php.net

ChangeLog
Version Description 
6.0.0 Added the before_needle parameter.  
4.3.0 strstr() was made binary safe.  


Where is version 6?
 [2008-03-15 09:49 UTC] felipe@php.net
Oh right, 5.3.0 is said at http://docs.php.net/strstr.
The docs.php.net is updated with more frequency.
 [2008-03-17 21:58 UTC] jakem at nittanytravel dot com
I don't even see where I can download 5.3.0?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 06:01:34 2024 UTC