Register and Login (User Account System) - Error

Ask about a PHP problem here.
Post Reply
dareskog
Posts: 12
Joined: Sat Jan 21, 2012 2:49 am

Register and Login (User Account System) - Error

Post 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:
$page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4);
Is there a way around this?
Cheers for the tutorial btw =]
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

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

Post 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:
$page = explode('/', $_SERVER['SCRIPT_NAME']);
$page = end($page);
$page = substr($page, 0, -4);
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

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

Post 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.
Image
Post Reply