Fatal error: Call to undefined function session_is_registered()

I upgraded the PHP version of one of my old applications. The application was not working as expected. Here is the first error I’ve received.

Fatal error: Call to undefined function session_is_registered()

28-1406550233-alanganallur

session_is_registered() has been removed in PHP 5.5. We may need to use $_SESSION(‘username’).

I replaced the old code with the following.

if(!(isset($_SESSION(‘myusername’))))

Now it ended up with the following error! (AGAIN!)

Fatal error: Cannot use isset() on the result of a function call (you can use “null !== func()” instead)

Then I replaced it like this.

$myusername=$_SESSION(‘_user’);
if(null == $myusername)

Now,

Fatal error: Function name must be a string

And finally, this one worked.

if (!isset($_SESSION[“_user”]))

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s