Hello

I have used swftools on other projects, but started a new piece of work, and kept running into some PHP warnings.

warning: Parameter 2 to flowplayer3_swftools_flashvars() expected to be a reference, value given in C:\wamp\www\drupal-6.14\includes\module.inc on line 450.

With the generic viewer, I would get video and audio, but no controls. Using flowplayer3, I would get controls, the whole frame, but the play button wouldn't work.

The only thing I can see being different is that I am using PHP 5.3.0 in my development suite (as part of wampserver), and a single-line in this article: http://php.net/manual/en/migration53.deprecated.php
.

Can anyone else confirm that PHP 5.3.0 breaks swftools, or have I got something else going on?

Thanks!

Comments

timatlee’s picture

Title: Errors on displaying FLV » Errors on displaying FLV with PHP 5.3.0

Small update.. Downgraded wampserver to 5.2.11 and Flowplayer 3 plays without an issue, as does the generic player (though still no controls, which may be by design if I remember correctly)

mariusilie’s picture

I get the same error. I guess SWFTools is not compatible with PHP 5.3...

irakli’s picture

I believe, it's Drupal that is not compatible with PHP 5.3 http://drupal.org/node/360605

eaton’s picture

Drupal 6.15 is compatible with PHP 5.3 save a minor issue with the 'ereg()' function in file.inc. This bug is separate and is specific to the SWFTools package. I'm seeing it on my PHP 5.3 local development setup, too.

naheemsays’s picture

Issue tags: +PHP 5.3

the issue is the same as #589326: Make swftools' onepixelout compatible with PHP 5.3 and a quick fix is to remove the & from all implementations of hook_swftools_flashvars($action, &$methods, &$vars) as is done in the attached issue for 1pixelout

in short, search the modules for "_swftools_flashvars($action, &$methods, &$vars)" and replace with "_swftools_flashvars($action, $methods, $vars)".

This will work for all php 5 users, but probably needs testing with php 4 before it can be committed to the cvs and fixed in an official release.

berdir’s picture

I don't see any changes to $methods/$vars so the change described by nbz should work.

Additionaly, that function contains the following code, and that will only work correctly on PHP5.

// Convert $flowplayer array to an object so we can pass it by reference in module_invoke_all()
$flowplayer = (object)$flowplayer; 
module_invoke_all('flowplayer3', $action, $methods, $vars, $flowplayer); 
vijayg’s picture

Hi Berdir

I am having the same error which you have posted and even i could not see any changes regarding the post of nbz. Berdir, is there any solution you got it. Looking forward from you

vijayg’s picture

Hi Berdir

The whole day i was looking for the solution i was finally land up in a dirty code :

read out this url :http://drupal.org/node/589326

i got the out put

Stuart Greenfield’s picture

I'll double check tonight, but the fix done in #589326: Make swftools' onepixelout compatible with PHP 5.3 replaced the old way of calling hook_swftools_flashvars() in all modules, so the new DRUPAL-6--3 branch should address the above.

Basically we avoid using module_invoke_all() since we know the player we are calling, so we can call its hook directly and pass by reference safely.

But I will check just to make sure...

Stuart Greenfield’s picture

Status: Active » Closed (duplicate)

Checked and confirmed - this is a duplicate of #589326: Make swftools' onepixelout compatible with PHP 5.3.

The main swf() function has been re-written so it no longer uses the module_invoke_all() call which is what causes the problem. We now call the specific hook_flashvars() function directly, and that way we can safely pass by reference.

Note - pass by reference is necessary since players like flowplayer need to create some flashvars, but also may need to amend the embedding method directly.

This is committed on branch DRUPAL-6--3 pending the SWF Tools 6.x-3.x release.

matthewdades’s picture

Worked for me! I followed the instructions nbz gave :)

larsdesigns’s picture

Worked for me by following the instructions on post #5.

The following files were edited:
/sites/all/modules/swftools/flowplayer/flowplayer.module
/sites/all/modules/swftools/flowplayer3/flowplayer3.module
/sites/all/modules/swftools/genericplayers.module
/sites/all/modules/swftools/imagerotator/imagerotator.module
/sites/all/modules/swftools/onepixelout/onepixelout.module
/sites/all/modules/swftools/simpleviewer/simpleviewer.module
/sites/all/modules/swftools/wijering/wijering.module
/sites/all/modules/swftools/wijering4/wijering4.module

andyf’s picture

I also had the issue that Flowplayer wouldn't play vids with PHP 5.3. I followed Stuart's instructions from #589326: Make swftools' onepixelout compatible with PHP 5.3 and it worked for me (and is a lot simpler than #5). Please note that Stuart warns that the issue isn't fully resolved by this. You can download this patch and see if it works for you.

madhavvyas’s picture

Use following patch, to solve swftool module problem

http://drupal.org/files/issues/swftools_2_5_php_5_3.patch

yaho’s picture

God bless you, dude! :-)

fuzzy76’s picture

This really needs a bugfix release :(

fuzzy76’s picture

The reason for this is a change in behaviour in PHP 5.3.0 that causes warnings on some module_invoke() calls: http://www.php.net/manual/en/ini.core.php#ini.allow-call-time-pass-refer...

The patch by madhavvyas looks like a promising workaround. Another alternative is just to disable the warning in php.ini

geraldito’s picture

Thanks AndyF for your patch linked on comment #13 which worked out perfectly.

aschiwi’s picture

Works well, thanks.