Photo_Shop Plugin: Call by Reference... Photo_Shop Plugin: Call by Reference...
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Photo_Shop Plugin: Call by Reference...

Started by GuidoR13, July 14, 2006, 12:57:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GuidoR13

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:
photoshop_prep_data(&$shop_array_cd, &$shop_array_photos)
to
photoshop_prep_data($shop_array_cd, $shop_array_photos);

Line 100:
function photoshop_prep_data($shop_array_cd, $shop_array_photos)
to
function photoshop_prep_data(&$shop_array_cd, &$shop_array_photos)

and all works fine...

Guido

Stramm

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

They are still being passed by reference.

GuidoR13

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
QuoteNote 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);.