-3

In php 5.4.32 the following line produces this fatal error:

....views/sales/register.php: 493","() Only variables should be passed by reference" 

In php 5.5.14 it does not produce an error.

Is there a setting in php.ini that would cause this to give a fatal error in one install and not the other?

I forgot to post that oops I thought I typed it in:

<td class="right"><?php echo to_currency($this->Giftcard->get_giftcard_value(end(explode(':', $payment['payment_type']))) - $payment['payment_amount']);?></td>

I am not asking WHY it is wrong, but how to reproduce.

EDIT: New question:

How do I make php 5.5 produce a fatal error when "Only variables should be passed by reference" happens.

I want to have as much errors as possible in development mode to support as many php platforms as possible.

Chris Muench
  • 17,444
  • 70
  • 209
  • 362

1 Answers1

2

Do you have E_STRICT turned off or on?

If it is on - it should warn against this problem

What does E_STRICT do?

For warnings as errors, see here:

Treating Warnings as Errors

Also check your display errors maybe?

Community
  • 1
  • 1
Shadow Radiance
  • 1,349
  • 13
  • 20
  • In php 5.5 I have E_ALL set which according to php.net should include that. My main complaint is that it produces a fatal error in php 5.4 but NOT in php 5.5. I am thinking there is another setting that changes the fatal nature of such errors – Chris Muench Oct 11 '14 at 18:46
  • Darn..After all this work I realized the person was a debug script had a die() in the script when it caught the error making it look like a fatal error. Sorry for all of this. – Chris Muench Oct 11 '14 at 19:09
  • Huh, I downvoted you initially thinking `E_STRICT` was irrelevant, but just retracted it. Something interesting I've learned from this thread - whether passing a non-variable by reference is a fatal error or an E_STRICT depends upon *what* you pass. Passing a literal (`function foo (&$bar) {}; foo('die');`) is fatal, but passing the result of a function call is only an `E_STRICT` (`function foo (&$bar) {}; foo(time());`). What a ridiculous language PHP is. I'll update that answer of mine you've linked to. – Mark Amery Oct 11 '14 at 21:04
  • @MarkAmery I agree. Php is a horrendously ridiculous language. I hate working in it. But it pays the bills at the moment. – Shadow Radiance Oct 11 '14 at 22:01