Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] PHP version compatible #87

Open
tungdt-90 opened this issue Jul 10, 2017 · 6 comments
Open

[Question] PHP version compatible #87

tungdt-90 opened this issue Jul 10, 2017 · 6 comments

Comments

@tungdt-90
Copy link

I use this module for my project, it runs well. But when I install on customer's host, I got the error:

Fatal error: Can't use method return value in write context in /home/***/dropzone/code/FileAttachmentField.php on line 785

I noticed that, the hosting is running with php 5.4.45, and my localhost is running in php 5.5 and above.

So, is it true that this module only compatible with php version >= 5.5 ?

@tungdt-90 tungdt-90 changed the title Required PHP version [Question ] PHP version compatible Jul 10, 2017
@tungdt-90 tungdt-90 changed the title [Question ] PHP version compatible [Question] PHP version compatible Jul 10, 2017
@dnpg
Copy link

dnpg commented Jul 13, 2017

Having the same issue here. it is related to this function and the way is used:

http://php.net/manual/en/function.empty.php

@unclecheese
Copy link
Owner

The required version should be 5.4... because I think it needs the (new Object())->method() syntax. If there is a case of empty() running on an expression, that needs to be changed. It probably got in via a PR.

I wasn't aware of that change in 5.5.. I thought empty() only took vars.

@dnpg
Copy link

dnpg commented Jul 13, 2017

To fix it you need to take out the postVar request from the empty function and add it to a variable:
Change this
if(empty($files) || empty($request->postVar($name))) {

to:

$var = $request->postVar($name);
if(empty($files) || empty($var)) {

@tungdt-90
Copy link
Author

I didn't notice it, either. Thank you @diegopego86 .

@tazzydemon
Copy link

That worked for me on 5.4 (I promise to upgrade php soon!)

@dianavila
Copy link

Will this issue be fixed? Or should I go with the posted solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants