Closed (fixed)
Project:
PHPTemplate
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2005 at 03:15 UTC
Updated:
18 Sep 2005 at 19:59 UTC
Jump to comment: Most recent file
A user recently reported this problem with image module (latest from CVS. Drupal is a few weeks old, but also CVS).
Parse error: parse error, unexpected ‘@’ in /home/demolici/shizzle/images/temp/crazyscrabbledude_0.jpg on line 30
When I try to preview an image to post.
Is the image module (or Drupal) attempting to execute image uploads? I've always had problems with this module, but this is a new one. What is trying to parse the temporary image file?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | phptemplate_patch.txt | 1.32 KB | robertdouglass |
| #2 | image-cvs-phptemplate.patch | 794 bytes | Robrecht Jacques |
Comments
Comment #1
Robrecht Jacques commentedI can confirm this bug.
- clean install of drupal CVS-HEAD and image CVS-HEAD
- enable image module
- create content (image)
- preview
- I get a similar error
- submit (instead of preview) works without problems.
Surely we are not parsing the images as php are we??
All works well in drupal-4-6 and image 4-6.
Comment #2
Robrecht Jacques commentedBoy oh boy. We *do* include the file.
The problem is in
_phptemplate_default. This function includes a template file withinclude($file). The problem is that the$fileit thinks it includes (a template file, egthemes/bluemarine/node.tpl.php) is not the$fileit includes (our image!). The reason for this is that it does aextract($variables)first and there is a$variables['file']in there! So his template-$file gets overwritten by our image-$file.Moving this issue to "phptemplate" as I think the bug is there. Easy fix attached.
Alternatively, every module should make sure it hasn't got a
$filevariable lying around... I'm not completely sure how the image-$file gets there, but it is.Comment #3
robertdouglass commentedThis type of bug should be sent to the devel list - it is a shortcoming of the project module that so little gets sent to that list.
Comment #4
moshe weitzman commentedI con confirm that this is a real bug. Good job finding the cause ... I'd love for a phptemplate expert to comment on the patch here.
Comment #5
moshe weitzman commentedimage.module shoud technically call its form field image_file in order to avoid conflict with other form fields ... still, it would be nice to fix this at the phptemplate leevl if possible.
Comment #6
Robrecht Jacques commentedRight. I'll create a patch for image.module that renames $file to $image_file.
Still, it is a bug that needs fixing in phptemplate too, just to be on the safe(r) side.
Comment #7
adrian commentedI've tested this with phptemplate before , the variable shouldn't get clobbered.
http://ca3.php.net/manual/en/function.extract.php
Rename it to image_file, since file is not telling enough anyway, and i will make a patch to turn the parameter into :
extract($variables, EXTR_SKIP);
Comment #8
Robrecht Jacques commentedThe issue has been fixed in image.module (rev 1.161): the module doesn't use '$file' anymore (thx to walkah).
Still I think that phptemplate should fix it too. From the documentation it seems like
extract($variables, EXTR_SKIP);would do the trick and is probably cleaner than theunsetI did.Did not test this patch and don't know if there are other side-effects.
(unassigning me from this issue)
Comment #9
robertdouglass commentedHere's a path against HEAD (after the commit of the previous patch) that takes Adrian's suggestion of using EXTR_SKIP instead. This solves the problem in a more fundamental way.
Comment #10
dries commentedCommitted to HEAD. Thanks.
Comment #11
(not verified) commentedComment #12
(not verified) commented