Forums / Bug Reports / Error coming from additional_images.php -- problems using + and [ and ] in image name

Error coming from additional_images.php -- problems using + and [ and ] in image name

Locked

Views: 6,427

Results 1 to 20 of 23
This thread is locked. New replies are disabled.
9 Feb 2007, 6:42 AM
#1
toytrains1 avatar

toytrains1

New Zenner

Join Date:
Feb 2007
Posts:
3
Plugin Contributions:
0

Error coming from additional_images.php -- problems using + and [ and ] in image name

Hello. I've recently installed Zen-Cart v.1.3.7 and was very impressed by how easily I was able to get the store up and running. However, I'm getting lots and lots of entries in /error_log which all say:

[07-Feb-2007 14:15:18] PHP Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Unknown modifier 'a' in /home/xxxx/public_html/cart/includes/modules/additional_images.php on line 47

Now, I haven't tinkered at all with that template (I've tinkered with very few, actually) and don't have a clue as to why it's throwing this error. Any help would be appreciated. Thanks.

11 Feb 2007, 6:27 PM
#2
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

If your includes/modudes/additional_images.php file,

if you replace:

if(preg_match("/" . $products_image_base . "/i", $file) == '1') {

with:

if(preg_match("/" . $products_image_base . "/i", $file) == 1) {

at line 47, will the error still appear in your logs ?

13 Feb 2007, 12:49 AM
#3
toytrains1 avatar

toytrains1

New Zenner

Join Date:
Feb 2007
Posts:
3
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Thank you. The error on line 47 has now gone away but we have an identical error shifted further into the file:

[12-Feb-2007 03:06:12] PHP Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Unknown modifier 'a' in /home/xxxxxx/public_html/cart/includes/modules/additional_images.php on line 93

13 Feb 2007, 2:38 AM
#4
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

A very strange query indeed I might add. In your includes/modules/additional_images.php file, on line 93 (approx);

find:

$noscript_link = '<noscript>' . ($flag_display_large ? '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large) . '" target="_blank">' . $thumb_regular . '<br /><span class="imgLinkAdditional">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' : $thumb_regular ) . '</noscript>';

replace with:

$noscript_link = '<noscript>' . ($flag_display_large) ? '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large) . '" target="_blank">' . $thumb_regular . '<br /><span class="imgLinkAdditional">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' : $thumb_regular. '</noscript>';
15 Feb 2007, 2:51 AM
#5
toytrains1 avatar

toytrains1

New Zenner

Join Date:
Feb 2007
Posts:
3
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

That appears to have solved the problem! Thanks very much for your help! :)

15 Feb 2007, 4:00 AM
#6
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Excellent. Glad to know this problem was about a typo query. :smile:

1 Mar 2007, 4:48 AM
#7
dbunch avatar

dbunch

New Zenner

Join Date:
Dec 2006
Posts:
25
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

I am getting this same error with version 1.3.7...

I made the change recommended to line 47 in this post...

My error is as follows...

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in /home/twolittl/public_html/catalogp/includes/modules/additional_images.php on line 47

You can view the error at this link...

http://www.twolittlebunnies.com/catalogp/index.php?main_page=product_info&cPath=2&products_id=21

The change did not fix my problem..

Dave

1 Mar 2007, 6:16 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

What version of PHP are you using?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Mar 2007, 9:30 AM
#9
dbunch avatar

dbunch

New Zenner

Join Date:
Dec 2006
Posts:
25
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

DrByte:

What version of PHP are you using?

4.4.4

General server information: Operating system Linux Service Status
Kernel version 2.6.9-42.0.2.ELsmp Machine Type i686 Apache version 1.3.37 (Unix) PERL version 5.8.7 Path to PERL /usr/bin/perl Path to sendmail /usr/sbin/sendmail Installed Perl Modules
PHP version 4.4.4 MySQL version 4.1.21-standard cPanel Build 10.9.0-STABLE 38 Theme cPanel X v2.6.0 Documentation
cPanel Pro 1.0 (RC36)

1 Mar 2007, 9:38 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

How many additional product images do you have for this product?
What are their filenames ?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Mar 2007, 10:01 AM
#11
dbunch avatar

dbunch

New Zenner

Join Date:
Dec 2006
Posts:
25
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

DrByte:

How many additional product images do you have for this product?
What are their filenames ?

Thanks Dr. Byte...

You hit it on the nail when you asked for the filenames..

Someone had changed the pictures on a couple of products and called them:

+filename.jpg so I changed them to filename.jpg

And the problem has gone away..

Thanks again

1 Mar 2007, 10:33 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Aha ... that makes sense ... the preg_match would croak on having a + symbol ... because Regular Expressions use + as a special parameter for pattern matching ... and Zen Cart isn't expecting to have + symbols in filenames ...

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Jun 2007, 1:54 AM
#13
ms_paperlicious avatar

ms_paperlicious

New Zenner

Join Date:
Jun 2007
Posts:
27
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

I'm having this same issue. I made the two changes suggested in the thread and now get a zillion of these on the page:
Warning: preg_match(): Unknown modifier 'b' in /Applications/xampp/htdocs/includes/modules/additional_images.php on line 47

When I uncomment this line (46)

if(preg_match("/" . $products_image_match . "/i", $file) == '1') {

I get just one error:

Parse error: parse error, unexpected $ in /Applications/xampp/htdocs/includes/modules/additional_images.php on line **114

**Only I can't figure out where anything is missing. I should say I'm a novice at PHP but a quick learner!

Any ideas!? When i uncommented that line did I need to add something elsewhere? Thanks so much.
**
Thanks-
Amy
**

Amy
Owner/Designer
http://www.paperlicious.com
Custom Printed Invites & Notes

Stylish. Affordable. Fun!

2 Jul 2007, 1:29 AM
#14
scrapgabbie avatar

scrapgabbie

Inactive

Join Date:
Jan 2004
Posts:
57
Plugin Contributions:
1

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

check your image filenames - l got this error in one category only, and upon checking the image names, found that they contained spaces, and lots of symbols ( ) ; - etc - once l renamed them all to something 'clean', the problem disappeared alltogether :-)

20 Aug 2007, 1:59 AM
#15
msmahoganey avatar

msmahoganey

New Zenner

Join Date:
Apr 2007
Posts:
10
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

I've done all the updates - also changed all 290 images in the store to a clean name but still get the error Warning: preg_match() [function.preg-match]: Unknown modifier '3' in /home/cq2730/public_html/store/includes/modules/additional_images.php on line **47. **Can someone help me?
https://www.eventboutique.ca/store

20 Aug 2007, 3:10 AM
#16
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Did you make the changes suggested in posts 2 & 4 above? You should not need to, as those lines did not cause the reported problem, and the post 4 change would actually cause a different error in some conditions.

20 Aug 2007, 3:55 AM
#17
rik avatar

rik

New Zenner

Join Date:
Nov 2005
Location:
Netherlands
Posts:
49
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Don't use [ and ] in the image names.

More info How do I add multiple images to a product?

zensational

20 Aug 2007, 12:36 PM
#18
msmahoganey avatar

msmahoganey

New Zenner

Join Date:
Apr 2007
Posts:
10
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

There was only one of the updates that I changed. As for the images - there are only a couple with [ ] in them. There are still images like the engraved beer mug which doesn't have the brackets and the error is still there. The only brackets are shown in the toolbar as the listed model number.

20 Aug 2007, 1:01 PM
#19
rik avatar

rik

New Zenner

Join Date:
Nov 2005
Location:
Netherlands
Posts:
49
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Your engraved beermug is available under:

Products_id=233 and the image is placed under:images/30008-L[1].jpg --> [] in the filename

and

Products_id=159 and the image translated under path :images//30008-L.jpg --> double // is because of wrong filename or incorrect images directory -> no picture shown.
Image available is under images/30008L.jpg

zensational

21 Aug 2007, 12:25 PM
#20
msmahoganey avatar

msmahoganey

New Zenner

Join Date:
Apr 2007
Posts:
10
Plugin Contributions:
0

Re: Error coming from additional_images.php -- problems using + and [ and ] in image name

Thank you everyone for your help. I had duplicate products (and didn't have each image updated). I have changed all of the image files - thank you guys for your help!