php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33113 Evaluating trim trim on an array kills it
Submitted: 2005-05-23 22:53 UTC Modified: 2005-05-23 22:55 UTC
From: c dot herzog at chsoftware dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.10 OS: XP
Private report: No CVE-ID: None
 [2005-05-23 22:53 UTC] c dot herzog at chsoftware dot net
Description:
------------
When you use a trim by mistake on an array, the array get's an string

Reproduce code:
---------------
settype($asd,"array");
$asd["a"] = "one";
$asd["b"] = "two";
$asd["c"] = "three";
echo gettype($asd); //-> array
print_r($asd);      //gets back the array

$asd = trim($asd); //trim it
print_r($asd);     //prints Array
echo gettype($asd);//gives string back

Expected result:
----------------
There should be an error, because a trim function can't be use to an array, or every offset should get trimmed.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-23 22:55 UTC] tony2001@php.net
There IS error:
Notice: Array to string conversion in ...
just turn display_errors On and set error_reporting to E_ALL.
 [2013-09-03 08:34 UTC] daverandom@php.net
Automatic comment from SVN on behalf of daverandom
Revision: http://svn.php.net/viewvc/?view=revision&revision=331274
Log: Typo fix in newt

---
Supplied by Anonymous #33113
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 05:01:29 2024 UTC