Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: CPG 1.2.0-final and PHP5 ?  (Read 6932 times)

0 Members and 1 Guest are viewing this topic.

Oz

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
CPG 1.2.0-final and PHP5 ?
« on: November 25, 2003, 11:14:07 pm »

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
Logged

viguera

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
CPG 1.2.0-final and PHP5 ?
« Reply #1 on: November 25, 2003, 11:47:09 pm »

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

Oz

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
CPG 1.2.0-final and PHP5 ?
« Reply #2 on: November 26, 2003, 08:34:33 am »

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
Code: [Select]

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
Logged

knives

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Thx , I have fixed this error
« Reply #3 on: March 14, 2004, 05:33:13 pm »

As title , i haved fixed the same error
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
CPG 1.2.0-final and PHP5 ?
« Reply #4 on: March 14, 2004, 11:09:27 pm »

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
Logged

exir

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: CPG 1.2.0-final and PHP5 ?
« Reply #5 on: October 03, 2004, 07:21:46 pm »

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
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: CPG 1.2.0-final and PHP5 ?
« Reply #6 on: October 03, 2004, 10:19:20 pm »

Logged
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
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 18 queries.