1

I (like a lot of others) am seeing Strict Standards errors with PHP 5.4.???.

Strict Standards: Only variables should be passed by reference in /home/xxxxxx/public_html/xxxxxx/init.php on line 64

There must have been a change between 5.3 and 5.4. All the "wisdom" on the Internet seems to be about turning the error messages off. In this case this is a program (1,000's of lines written by someone else) that I am disinclined to try to resolve.

If I turn off the error reporting then the script does not execute.

I am trying to work the issue with the writer of the script.

Is there any other solution? Is there a setting that can be placed in the .htaccess file that will allow "non strict standards"?

Eric Snyder
  • 1,816
  • 3
  • 22
  • 46
  • 1
    You basically have two options: fix the errors or turn the _strict_ error messages off (with `error_reporting(E_ALL ^ E_STRICT)`, for example). – raina77ow Nov 25 '13 at 18:59
  • By the way...the line of code is a messy affair like this: define("INSTALL_URL" , $protocall.$host_name . str_replace("/".array_pop(explode("/",$_SERVER['REQUEST_URI'])),"/",$_SERVER['REQUEST_URI'])); – Eric Snyder Nov 25 '13 at 18:59
  • FWIW, the problem in that line is the `array_pop`, which wants to modify its argument (it removes the item as well as returning it), but can't because it's being given the return value of `explode` rather than a variable. – IMSoP Nov 25 '13 at 19:06
  • "If I turn off the error reporting then the script does not execute." This sounds very unlikely (unless your script is actually failing already and you're just not seeing it in the sea of strict standards notices). – IMSoP Nov 25 '13 at 19:07
  • possible duplicate of [Strict Standards: Only variables should be passed by reference](http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference) – Lorenz Meyer Jun 21 '14 at 08:28

2 Answers2

2

You need to go into your php.ini file and assign the following:

 error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT     

This will allow you to show all warnings except deprecated & non-strict standards.

justinpage
  • 623
  • 7
  • 18
  • I have done so in my php.ini. The script still executes and returns blank (a sign that there are errors). I added to the script error_reporting(E_ALL); and still no reported errors. – Eric Snyder Nov 25 '13 at 19:31
  • Because it is not printing any errors, this means it IS doing what is intended. In other words, it is allowing the non-strict standards you like. Because of this, the problem does not lie on whether strict standard errors are reporting but something within your script. Deduct that it is indeed not your script that is wrong. – justinpage Nov 25 '13 at 20:20
1

If you want to fix the error rather than ignore it (recomended):

$uri = explode("/",$_SERVER['REQUEST_URI']);
define("INSTALL_URL" , $protocall.$host_name . str_replace("/".array_pop($uri),"/",$_SERVER['RE‌​QUEST_URI']));
mcrumley
  • 5,682
  • 3
  • 25
  • 33