• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

Fatal error: Call to undefined function session_is_registered() in


I know the cause of this issue. I have PHP 5.4 on a new host and this error is due to that since it was older on another host.

Is there something I can edit in a custom php.ini file to make this go away and still keep using it?

Computer Guy
Computer Guy
1 Solution
You can't use it, it's been removed.

Now you have to check if it is set

Brian TaoSenior Business Solutions ConsultantCommented:
I haven't tried it but I think you can add the following code to your script so that it runs on both old and new PHP versions:
if (!function_exists('session_is_registered')){
  function session_is_registered($sess_name){
    return (isset($_SESSION[$sess_name]));

Open in new window

Ray PaseurCommented:
Please see the second foreword to this article:

Executive summary: This was deprecated at PHP 5.3, over 5 years ago.  There are other, current PHP functions that do things the right way, so just correct the code.  Here's one suggestion:
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Computer GuyAuthor Commented:
This is what the original code is:
      if (session_is_registered($k))        continue;

Is this the correct syntax to replace it with?
      if (!function_exists('session_is_registered($k'))continue;{
  function session_is_registered($k){
    return (isset($_SESSION[$k]));
Ray PaseurCommented:
Umm, probably this is a correct replacement.
if (isset($_SESSION[$k])) continue;

Open in new window

If you want to explore the deep-background thinking on the session-register concept and why it's not used any more, learn about register-globals.  Automatic injection of external variables was supposed to make PHP "easy" but it actually made PHP horribly insecure and hackable, so we don't do that any more.

If you look at your code base and find a lot of instances of session_is_registered() then it might make sense to define the function, but my thinking would be to just correct the code, since the correction using isset() will be forward and backward compatible.
Ray PaseurCommented:
To amyone coming upon this Q/A in the future, the explanation of the issue can be found here:

And the correct answer (at least the one that won't get you fired) is here:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now