array_merge fails at line 311
| Project: | SWF Tools |
| Version: | 5.x-1.x-dev |
| Component: | SWF Tools |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Flashnode and SWFTools don't play nicely together anymore :-(
warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\htdocs\modules\swftools\swftools.module on line 311.
warning: Invalid argument supplied for foreach() in C:\htdocs\modules\swftools\swftools.module on line 618.
warning: Invalid argument supplied for foreach() in C:\htdocs\includes\common.inc on line 210.
The problem appears to be that when swf() is called it then sets the variable $player_flashvars. However, this is being assigned a value of 1, so line 311 throws an error.
If I comment out line 311 it works, but that is obviously not the solution! I'm unfamiliar with how the media embedding system works so am not sure where to look.
This is a new bug - the modules were working together previously!

#1
Sorry about these glitches. I've really been thinking about the overall structure and so when I did that change to the parameters I also addressed 101 things I wasn't happy with. Much better to do this before the release, because once I've released I don't want to muck around with the API at all. So, I promise I've finished my refactoring now :)
This problem is because I want hook_flashvars, as standard usage, to require the called function to return the flashvars array. The receiving module can, of course, catch the params and othervars by reference and modify them - but generally this shouldn't be something you'd even want to do when implementing a Flash Player etc.
So, all you need to do is return $vars->flashvars instead of TRUE, or whatever you are currently doing.
#2
Sorry - not fixed. The bug is with swftools, not me!
I added some print_r lines to see what is happening around line 311...
Line 310 calls
<?php$player_flashvars = call_user_func_array($resolved_methods->player['module'] .'_swftools_flashvars', array($action, &$resolved_methods, &$vars));
?>
For simple flash insertion this calls
swftools_swftools_flashvarsThis function is in swftools and all it does is return
TRUE. This sets$player_flashvarsto true, so at line 311 the array merge fails since it tries to merge a non-array with the flashvars array.If instead
swftools_swftools_flashvarsreturnsarray()then the problem goes away.I think that is the fix? I've not attached a patch as the change is trivial.
<?phpfunction swftools_swftools_flashvars($action, &$methods, &$vars) {
return array();
}
?>
#3
You are right about this and the swfobject id thing. I made some changes on the train this morning and I'll commit it tonight.
Yeah, I'm not worried about patches for changes like this. It is much more valuable having your ongoing reviews and testing, so whatever is easiest for you I say.
#4
Fixed I'm pretty sure now.
#5