Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Photo_Shop Plugin: Call by Reference...  (Read 4789 times)

0 Members and 1 Guest are viewing this topic.

GuidoR13

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 22
Photo_Shop Plugin: Call by Reference...
« on: July 14, 2006, 12:57:41 pm »

Hello, really good the Photo_Shop Plugin! Really! Thanks a lot.

My version is: photo_shop_jul_01_2006.zip

Nevertheless I get some annoying PHP warnings with drepacted call by reference. Seems to be a PHP.INI setting, which I can not change.

I'm no PHP programmer, but I changed in photo_shop_checkout.php:
Line 50 & 83:
Code: [Select]
photoshop_prep_data(&$shop_array_cd, &$shop_array_photos)to
Code: [Select]
photoshop_prep_data($shop_array_cd, $shop_array_photos);
Line 100:
Code: [Select]
function photoshop_prep_data($shop_array_cd, $shop_array_photos)to
Code: [Select]
function photoshop_prep_data(&$shop_array_cd, &$shop_array_photos)
and all works fine...

Guido
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Photo_Shop Plugin: Call by Reference...
« Reply #1 on: July 14, 2006, 01:31:47 pm »

The & before the argument is to make it be passed by reference. If you remove it then I'm nearly sure that the plugins functionality suffers

Nibbler

  • Guest
Re: Photo_Shop Plugin: Call by Reference...
« Reply #2 on: July 14, 2006, 01:59:27 pm »

They are still being passed by reference.
Logged

GuidoR13

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 22
Re: Photo_Shop Plugin: Call by Reference...
« Reply #3 on: July 14, 2006, 02:20:52 pm »

Yep, they are passed by reference.

But the "by reference" ist declared with the functions definition and not while function call. This is the "correct" style, as far as I understand the PHP docu (anyway I'm not a PHP programmer):

http://de3.php.net/manual/en/language.references.pass.php
Quote
Note that there's no reference sign on function call - only on function definition. Function definition alone is enough to correctly pass the argument by reference. In recent versions of PHP you will get a warning saying that "Call-time pass-by-reference" is deprecated when you use a & in foo(&$a);.


Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.