Page 1 of 1

Register and Login (User Account System) - Error

Posted: Sat Jul 14, 2012 7:08 pm
by dareskog
Hi,
I've just gone through the php tutorial on the above stated but keep getting this error:
"Strict Standards: Only variables should be passed by reference"
this then points to the line on the init.inc.php which reads:
[syntax=php]
$page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4);
[/syntax]

Is there a way around this?
Cheers for the tutorial btw =]

Re: Register and Login (User Account System) - Error

Posted: Sat Jul 14, 2012 10:52 pm
by Temor
Yes, there are two ways to do this.
The first one is to turn of error reporting. That error is not harmful in any way. So removing strict reporting from your error reporting would be sensible.

The other one is to split the functions to new lines like this:
[syntax=php]$page = explode('/', $_SERVER['SCRIPT_NAME']);
$page = end($page);
$page = substr($page, 0, -4);[/syntax]

Re: Register and Login (User Account System) - Error

Posted: Tue Jul 17, 2012 3:15 pm
by jacek
It's not even an error, it's a "you should do it like this" message ;)

You can safely hide the message as Temor said, but I would not turn error reporting off as that would hide useful errors too, you should set it to E_ALL only.