| View previous topic :: View next topic |
| Author |
Message |
l2g3 Pivot Groupie In Training


Joined: 29 May 2007 Posts: 3
|
Posted: Tue May 29, 2007 5:22 pm Post subject: Notice: Array to string conversion |
|
|
Pivot version: 1.40.1
Install: clean
OS: WindowsXP Pro SP2, Firefox 2.0.0.3
Devel platform on the same computer: XAMPP 1.6.1
PHP status: safe_mode = Off, register_globals = Off, error_reporting = E_ALL
Description: while logged in as Administrator, go to menu "New Entry", enter any new entry data (only title and introduction with some text) for testing, then press button "Preview Entry", new window opens for entry preview - on top of this page content notice text is produced:
| Code: |
| Notice: Array to string conversion in C:\xampp\htdocs\pivot-test-site\pivot\first_defense.php on line 120 |
Solution: array $postedData on line 120 (in file C:\xampp\htdocs\pivot-test-site\pivot\first_defense.php) has to be imploded recursively, because any element of arrays $_GET and $_POST can be an array. In my case it seemed to be true. So replaced that code line with this code:
| Code: |
//This function will implode a multi-dimension array
//Function code taken from php manual description of function implode(), commenter gregrahkin
function implode_r($glue, $pieces){
$out = "";
foreach($pieces as $piece)
if(is_array($piece)) $out .= implode_r($glue, $piece); // recurse
else $out .= $glue . $piece;
return $out;
}
$postedData = strtolower(implode_r(" ", $postedData));
|
|
|
| Back to top |
|
 |
hansfn Pivot Team


Joined: 15 May 2004 Posts: 5267 Location: Molde, Norway
|
Posted: Tue May 29, 2007 5:41 pm Post subject: Re: Notice: Array to string conversion |
|
|
Just lower your error reporting level. You are using "E_ALL", which is fine if you are developing PHP software and need the extra info, else use "E_ALL ^ E_NOTICE". There are plenty of other notices - "No index xyz ..." and so on.
It's a notice, not an error, not even a warning ... PHP did do the right thing - no harm in using the current code as it is. _________________ My Pivot bookmarks, snippets and scripts| Pivot Documentation Project: Template tags |
|
| Back to top |
|
 |
l2g3 Pivot Groupie In Training


Joined: 29 May 2007 Posts: 3
|
Posted: Wed May 30, 2007 8:20 am Post subject: Re: Notice: Array to string conversion |
|
|
Well, in that case my standards are a little bit higher
I won't let any Notice exist. My rule: in the development environment no notices shoud be present.
| hansfn wrote: |
Just lower your error reporting level. You are using "E_ALL", which is fine if you are developing PHP software and need the extra info, else use "E_ALL ^ E_NOTICE". There are plenty of other notices - "No index xyz ..." and so on.
It's a notice, not an error, not even a warning ... PHP did do the right thing - no harm in using the current code as it is. |
|
|
| Back to top |
|
 |
hansfn Pivot Team


Joined: 15 May 2004 Posts: 5267 Location: Molde, Norway
|
|
| Back to top |
|
 |
l2g3 Pivot Groupie In Training


Joined: 29 May 2007 Posts: 3
|
Posted: Wed May 30, 2007 9:50 am Post subject: Re: Notice: Array to string conversion |
|
|
Maybe, maybe not
But nevertheless Pivot is great  |
|
| Back to top |
|
 |
hansfn Pivot Team


Joined: 15 May 2004 Posts: 5267 Location: Molde, Norway
|
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|