Closed (fixed)
Project:
Embedded Media Field
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
20 Jun 2007 at 13:02 UTC
Updated:
9 Aug 2007 at 19:33 UTC
Jump to comment: Most recent file
Comments
Comment #1
Souvent22 commentedIt seems that some version of PHP do not decouple well; meaning going to from obj. to array, etc.
Example, the following code set throws the string off set error:
However, this code does not:
Almost exactly the same except I take out the entire array and then place it back as a whole. I haven't found the exact reason why this is yet; but i've tested it a lot, and this seems to be the cause of it.
For reference, I'm using:
PHP 5.2.3
Windows
Apache 2.2
xDebug enabled
Comment #2
karens commentedUsing $node_field is the right approach, that's the way it's done in CCK core. Need to make the same fix in the non-multiple value code and apply it back to the $node object. A patch is attached that I think will do it.
Comment #3
ayolassan commentedThis patch is working perfectly
Tks a lot
Comment #4
karens commentedI'll move this to the new project.
Comment #5
Souvent22 commentedRolled a new patch
Comment #6
edwardrapley commentedMaybe the patch was not quite right, i had to add an } on line 161 and remove one on line 177. Then it worked fine. But i was patching manually so maybe i made the mistake.
Comment #7
robloachI was experiencing this issue, and the patch you created seemed to fix it. Strange issue. Anyone know why this was happening? Probably has to do with PHP casting the values incorrectly or something.
Comment #8
jtorres543 commentedMy approach took 1 less line but I came to the same result. I don't know if there are any performance implications (I assume it would be negligible).
This is caused by a change in PHP5 http://www.php.net/manual/en/migration5.incompatible.php
According to PHP.net it is a "bad habit" that will no longer be supported.
Comment #9
jtorres543 commentedI misspoke, It is the same amount of code but it seems to me that mine should be correct as the original code would not modify the $node->field_name, but rather, a copy of it.
Comment #10
boris mann commentedSame error on PHP5 with this:
However, I just wrapped field_name in curly brackets and it works:
Comment #11
mamasdiner commentedBoris,
Your fix worked for me.
Thanks!
Heather
Comment #12
TX1121 commentedit seemed to work fine for me when going into the original emfield.module file and puting "{" before and after $field_name.
Comment #13
aaron commentedThanks for the work! Sorry I was unavailable the last few weeks -- I was moving out of state. I'll take a look at the patches and roll them in by early next week. (Still unpacking boxes this weekend.)
It must be a PHP5 thing -- I don't experience this in PHP4. I don't have PHP5 installed locally yet, and don't plan to until I start helping with D7 development. From the thread, though, it looks like this is a sounder solution anyway. Meanwhile, once I make sure the patch doesn't break in PHP4, will one of you be willing to test in PHP5 once the patch is in just to make sure?
Thanks,
Aaron
Comment #14
drumchef commentedI can confirm that the code Boris provided works with PHP5. Thanks!
Comment #15
green monkey commentedthank you for this patch
Comment #16
aaron commentedThanks for the help with this! I don't have php5 installed yet, but this all works w/ php4. I just put the curly brackets around $node->{$field_name} as Boris suggested in the two lines they appeared. After the repository synchs, could someone using php5 confirm this release works? I'll make sure to use this coding standard in the future.
Thanks,
Aaron Winborn
Comment #17
dsp1 commentedi was having an error that was different. When trying to view a node that had the video field I would get a blank screen.
the log would show this entry:
include_once(./themes/engines/phptemplate/phptemplate.engine) [function.include-once]: failed to open stream: No such file or directory in /Users/ddp/Sites/drupal/includes/theme.inc on line 78.
Boris, this fixed my error too.
Drupal 5.1, PHP 5.22, CCK 1.5
Comment #18
(not verified) commented