2

Currently, I'm working with php 5.4, and would like to move to 5.6 and also PHP 7. I'm checking the code hosted on my server and realized that there is CodeIgniter code that might outdated.

@ini_get("safe_mode")

Because from what I have searched, safe_mode is no longer supported and deprecated.

I'm not sure about that CodeIgniter code. So wish to ask everyone to confirm whether it's outdated or not. If yes, what is the solution for this?

Example (part of the code):

/*
 * ------------------------------------------------------
 *  Set a liberal script execution time limit
 * ------------------------------------------------------
 */
 if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)
 {
    @set_time_limit(300);
 }
Evelyn
  • 656
  • 7
  • 29
  • what CI version are you using? – JMS786 Jul 24 '17 at 08:52
  • 2.1.3. The website is developed by other developer. I'm not familiar with Codeigniter – Evelyn Jul 24 '17 at 09:07
  • The latest version as of today is 3.1.5, and I don't find any issue regarding the safe_mode.. check the web [https://codeigniter.com/](https://codeigniter.com/) – JMS786 Jul 24 '17 at 09:11
  • 1
    That's means I still can use that code? Because there are other sections implement safe_mode as well. – Evelyn Jul 24 '17 at 09:19
  • In localhost, serve vagrant environment with features you would like to be there. Move your site and check what errors you have got. Fix one at a time. – Tpojka Jul 24 '17 at 09:54
  • Ok! Thanks :) Will try. – Evelyn Jul 25 '17 at 03:56

2 Answers2

1

From the PHP point of view, @ini_get is a function to get the configuration option.. if it does not find the configuration name, it return FALSE as documented here

So, when you're updating to PHP 5.6 or PHP 7, yes it is outdated, but it won't cause error. It's just CodeIgniter will handle things differently.

JMS786
  • 1,103
  • 2
  • 11
  • 22
  • You're welcome.. Did you know that, accepting an answer would get you reputation point ?? :), besides it will help others with similar question as well.. :) – JMS786 Jul 27 '17 at 16:42
0

If you're using a recent version of CodeIgniter (3.1.x is current), then there should be no problems. The code you've shared there does look a bit ... legacy, this is likely to be an older version. I suggest you check the project documentation and check whether you can upgrade from your version to the newest which should then work with more recent versions of PHP.

Lorna Mitchell
  • 1,819
  • 13
  • 22
  • The Codeigniter version is 2.1.3, the website was developed on 2014. But I saw there are some backup code, e.g `if (! is_php('5.3')){ @set_magic_quotes_runtime(0); // Kill magic quotes}` I think that code might helps some. – Evelyn Jul 24 '17 at 09:11