CPG 1.2.0-final and PHP5 ? CPG 1.2.0-final and PHP5 ?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

CPG 1.2.0-final and PHP5 ?

Started by Oz, November 25, 2003, 11:14:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Oz

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

viguera

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... :)

Oz

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

knives

As title , i haved fixed the same error

Joachim Müller

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

exir

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

Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here