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
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: c dot herzog at chsoftware dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 11:01:34 2025 UTC