2
votes

this php row

if ($this->config->get('refprogram_sharing_enable') && !empty($this->config->get('refprogram_sharing_links'))) {

returns error message Fatal error: Can't use method return value in write context

2
this code seems to be alright, problem will be in other part of codeMarek Janoud
Please paste the code around this line. This line seems to be fine, so the issue must be on the line before or after.Scalpweb

2 Answers

0
votes

If you are using a version of PHP older than 5.5, you can only use variables within empty, and not method calls, otherwise it will throw the error you have received.

A solution would be to calculate the return value first, for example:

$links = $this->config->get('refprogram_sharing_links');

if ($this->config->get('refprogram_sharing_enable') && !empty($links)) {

Depending on the output of your get method, you could also try

&& $this->config->get('refprogram_sharing_links') !== false

Hard to tell if this would work without seeing the rest of your code, though.

0
votes

In case if the first variable is string and the second is array:

$refprogram_sharing_enable = $this->config->get('refprogram_sharing_enable');
$refprogram_sharing_links = $this->config->get('refprogram_sharing_links');

if ( $refprogram_sharing_enable!='' && !empty($refprogram_sharing_links)) {

}