php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46428 Can't make string comparison if the string ends with '=='
Submitted: 2008-10-30 11:08 UTC Modified: 2008-10-30 11:32 UTC
From: jaume dot bosch at atrapalo dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.6 OS: FreeBSD
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jaume dot bosch at atrapalo dot com
New email:
PHP Version: OS:

 

 [2008-10-30 11:08 UTC] jaume dot bosch at atrapalo dot com
Description:
------------
In the code below, you can see a string called 'foo', if you try to make a strstr, strpos, ereg, ..., to this string you get this error:



It seems that a string ending with '==' it's understand as a function call.

Reproduce code:
---------------
<?php
$foo='asdfdgfsg==';
if (strstr($foo,'==')) $foo=substr($foo(0,strlen($foo)-2));
    
echo $foo;
?>

Expected result:
----------------
asdfdgfsg

Actual result:
--------------
PHP Fatal error:  Call to undefined function asdfdgfsg==() in /usr/home/myuser/test.php on line 3
PHP Stack trace:
PHP   1. {main}() /usr/home/myuser/test.php:0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-30 11:09 UTC] felipe@php.net
See: $foo=substr($foo(0 <---------  ,strlen($foo)-2));
 [2008-10-30 11:32 UTC] jaume dot bosch at atrapalo dot com
ok, sorry it's only a copy-paste bug on myself

Thx a lot
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC