php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64702 strpos behavior with integers
Submitted: 2013-04-24 01:08 UTC Modified: 2013-04-26 17:57 UTC
From: lgynove at 163 dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.24 OS: windows xp
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: lgynove at 163 dot com
New email:
PHP Version: OS:

 

 [2013-04-24 01:08 UTC] lgynove at 163 dot com
Description:
------------
this is bug?

Test script:
---------------
var_dump(strpos(1111, 11)) //false
var_dump(strpos(1111, '11')) //0

Expected result:
----------------
var_dump(strpos(1111, 11)) //false
var_dump(strpos(1111, '11')) //0

Actual result:
--------------
var_dump(strpos(1111, 11)) //false
var_dump(strpos(1111, '11')) //0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-24 01:27 UTC] laruence@php.net
this isn't bug

"
If needle is not a string, it is converted to an integer and applied as the 
ordinal value of a character.
"
 [2013-04-24 01:28 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2013-04-24 01:28 UTC] laruence@php.net
as previous comment said
 [2013-04-26 17:57 UTC] sixd@php.net
-Summary: this is bug? +Summary: strpos behavior with integers
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 23 01:00:02 2025 UTC