0

Is it possible to add a removed/deprecated function to PHP5? Like session_is_registered, ereg, etc.


[update] solved for session_is_registered:

<?php
function session_is_registered($name) {
    return isset($_SESSION[$name]);
}

thanks.

5
  • Do you mean php native functions or user-defined functions. I wonder why you need to bring deprecated function back to your php-version. There is no need for that. Commented Mar 3, 2014 at 9:50
  • 6
    That is possible if you fetch the sources and compile them yourself after having re-integrated those features from older versions. However you really do not want to do that: besides that it takes a huge effort please consider that there are very good reasons why certain functions are deprecated and removed. There always are very good replacements available. Instead of wasting your time, money and power to outdated stuff, invest into the future instead. Commented Mar 3, 2014 at 9:50
  • @Mubo session_is_registered and ereg are native. Commented Mar 3, 2014 at 9:51
  • Why you want to do this? They are deprecated for a reason use isset($_SESSION['test']); or similair instead. Commented Mar 3, 2014 at 9:51
  • I don't know. It's just crossed in my mind. @arkascha : I'll try it. thank you for your attention guys Commented Mar 3, 2014 at 10:02

1 Answer 1

1

Of course you can do it by modifying and recompiling the PHP source code, however the first question you have to answer is Do I really need to this or I might be better to go for my IDE's find-and-replace function?

If there is a real need for this -- for whatever reason, maybe you can redefine those functions. I haven't test it yet, as I agree with others that functions and features get removed or deprecated for a good and mostly important reasons, so I'm not sure if it does work in a situation that the function is removed or depreciated, but you can try to redefine them either using runkit_function_redefine or override_function.

In that case you have to simulate the functionality again -- probably with their good-to-go replacements, so again think twice before start doing that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.