Jump to content


This topic is now archived and is closed to further replies.


: implode() [function.implode]: Invalid arguments passed in /home......./admin/i

Recommended Posts

Im not sure how to fix this error.


Here is the line...


<TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA>



and the code...?


if($q) {

$filename = "../includes/pages/$q";

if(!is_writable($filename)) {

die("<b>$q</b> is not writable! All files in your includes/pages directory should be CHMOD 666");


$text = @file($filename,"r");

echo '<b>EDIT PAGE</b> : '.$q.'

<FORM action="index.php" method="POST">

<INPUT type="hidden" name="q" value="'.$q.'">

<TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA>

<br><INPUT type="submit" name="submit" value="Save page">






Any help would be greatly appreciated.  I'm brand new at type of coding.

Share this post

Link to post
Share on other sites

$text is quite obviously not an array.

Share this post

Link to post
Share on other sites

As Thorpe mentioned, $text is not an array. The underlying problem is that you botched the file() function call: the second parameter should be an integer not a string (see file).


The original error is suppressed by the @ in front of the file() call (output in comments):


$text = file('test', 'r'); //PHP Warning:  file() expects parameter 2 to be long, string given in php shell code on line 1
var_dump($text); //NULL
implode('', $text); //PHP Warning:  implode(): Invalid arguments passed in php shell code on line 1

$text = file('test');
var_dump($text); /*array(2) {
                                    string(6) "line1
                                   string(6) "line2
echo implode('', $text); /*line1

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.