php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53261 strlen
Submitted: 2010-11-08 05:28 UTC Modified: 2010-11-08 06:14 UTC
From: start-v at qq dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.3.3 OS: FreeBSD 8.1
Private report: No CVE-ID: None
 [2010-11-08 05:28 UTC] start-v at qq dot com
Description:
------------
<?php
$str = '';
var_dump ( $str ); // string(0)""
// strlen ( $str ) // 0   Normal
?>

<?php
$str = 'str';
$str [ 1 ] = '';
var_dump ( $str ); // string(3) "sr" 
// strlen ( $str ) // 3  Bug
?>

<?php
$str = 'str';
$str = str_replace( $str [ 1 ], '', $str );
var_dump ( $str ); // string(2) "sr" 
// strlen ( $str ) // 2  Solution
?>


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-08 06:14 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2010-11-08 06:14 UTC] cataphract@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.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

In $str [ 1 ] = '';, the second character is replaced by \x00.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 07 23:01:27 2024 UTC