Hi,
I've just tried installing CPG120final on a freebsd box running PHP 5.0.0a3-alexdupre. It seems to work, except when trying to batch add pictures I get the following error:
Fatal error: Cannot redeclare scandir() in /path/to/gallery/searchnew.php on line 309
Has anybody seen this (and fixed it ;-) )then please let me know.
Rgds
Oz
Weird... I'm no PHP genius but it sounds like there's another "scandir" function somewhere else -- a quick search of the CPG stuff shows that there's only one, however.
I'd venture a guess and say that if you hack the searchnew.php and change the function name and calls, it will probably go away. Of course, that's just a temporary fix until somebody figures out what the deal is...
Under the impression that you already know the standard disclaimer that if you break your box it's on you, I'd say that you can do this:
Change line 282 in searchnew.php from:
function scandir($dir, &$expic_array)
to
function cpgscandir($dir, &$expic_array)
then the calls on 305 from
scandir($dir . $directory . '/', $expic_array);
to cpgscandir($dir . $directory . '/', $expic_array);
and line 393 from
if (scandir($HTTP_GET_VARS['startdir'] . '/', $expic_array)) {
to if (cpgscandir($HTTP_GET_VARS['startdir'] . '/', $expic_array)) {
You might wanna make a backup first, in case I'm wrong -- which I could be... :)
Thanks - you're obviously right. I guess I was too tired to read by myself :oops: .
The function "scandir" clashes with a new function in PHP5 of the same name (http://www.php.net/manual/en/function.scandir.php ). In case anybody else is/wants to be playing around with PHP5, I just did a
mv searchnew.php searchnew.php.ORIG
sed 's/scandir/cpg_scandir/g' searchnew.php.ORIG > searchnew.php
And now it seems to work!
Thanks again,
Oz
As title , i haved fixed the same error
Thanks for pointing this out - it's a known issue and has been solved in the next version of coppermine which will (hopefully) be released soon, where we renamed the function in searchnew.php (it only is in that particular file - you can simply replace "scandir" with "CPGscandir").
Afaik PHP5 is still experimental - such clashes may happen with other apps as well when using PHP5...
GauGau
At the server where my site is being hosted is running php5.0.2
i have applied the hack but i still dont see any images.
what already worked is that i can add pictures with the batch add picture function, before the hack i did get the same error as above
does anyone know a solution to this?
hope so
What version are you using.
Try these threads, and the ones they link to;
http://forum.coppermine-gallery.net/index.php?topic=10066.0
http://forum.coppermine-gallery.net/index.php?topic=10482.0