php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21495 strlen, substr and so on bug
Submitted: 2003-01-07 12:17 UTC Modified: 2003-02-18 10:34 UTC
From: roger4a45 at yahoo dot es Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.2.3 OS: windows 2000 server sp3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: roger4a45 at yahoo dot es
New email:
PHP Version: OS:

 

 [2003-01-07 12:17 UTC] roger4a45 at yahoo dot es
whe we use strlen or substr there is a bug if parameter string is something like this: 

$a = "<HTML><HEAD><TITLE>something</TITLE></HEAD><BODY>hi!</BODY><HTML>";
$b = strlen($a);
echo $b;

output is 0 rather real length of string.... Substr don't work right if we use same $a... 

any idea?

Is use a PHP 4.2.3 (ZIP file)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-07 12:22 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.
 [2003-01-07 12:26 UTC] roger4a45 at yahoo dot es
A bug is when a function don't work properly... so, if I make strlen("<HTML>") i wait that output will be 6. if strlen produce another result is a bug. Ok. I will try to comment it to support forum. Thanks.
 [2003-02-18 09:43 UTC] public at hverdag dot dk
Excuse me roger4a45, but isn't that exactly what the problem is?! That it returns another output than expected?!
It returns 0 where it SHOULD return something around 50!

I probably have the same problem with strlen. When I use this:

if (strlen($mydateformat) < 4)

...and I _KNOW_ that $mydateformat is longer than 0, it often returns the length 0! But then when I reload the page the error doesn't occur again - usually only the first time I run this page in a new browser window!

To me this really sounds like a bug...
 [2003-02-18 10:34 UTC] roger4a45 at yahoo dot es
I think my problem is when I use strlen inside a class with HTML TAGS delimiters ('<' and '>'). Behavior of strlen is bad. if $a = "<HTML>" it says that strlen($a) is 0 rather than 6. I used substr to change '<' and '>' for '?' and '&' and then use strlen. but of course is dirty-dirty.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC