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
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: 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