Object of class Directory could not be converted to string
I just upgraded our server to PHP 5.2.6 and did install the new html_output.php files but I'm getting this error when I try to edit a product in the admin
Catchable fatal error: Object of class Directory could not be converted to string in /home/ccu/public_html/shop/jNk699/includes/modules/product/collect_info.php on line 548
Line 548 is the echo line below:
<?php
$dir1 = @dir(DIR_FS_CATALOG_IMAGES."/FlashImage");
echo $dir1;
?>
This is part of a custom mod to our cart but the developer is MIA.
Any suggestions??
Re: Object of class Directory could not be converted to string
dir() returns an object to $dir1, so you need to use the appropriate methods in that object to access the data stored inside it.
A dir() object uses a "read" method, so, in the case of your "echo $dir1" statement, you could render it differently as such:
Code:
echo $dir1->read();
For more info, read up on the syntax and documentation at www.php.net
(To get the entire folder's directory listing, you'd need to loop through all the $dir1 object's values, typically using a WHILE loop. Examples of this can be found on the php.net site.)
Re: Object of class Directory could not be converted to string
You rock!! I was hoping it was simple...simple for someone who understood the coding.
Can I get you a cup of coffee?!
Re: Object of class Directory could not be converted to string
Re: Object of class Directory could not be converted to string
I appreciate the help. This is the second cup this week. Linda (Ajeh) got one on Monday too!