Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of deprecated functions between php4.4 -> php7

Tags:

php

version

I have a website on a server with php 4.4. (Yes, it exists)

I must move it on an other hosting with php 7 I've tried in local, and it's full of errors and nothing works.

For "scan" the files, I want make a script to find the old function and, after, one by one, "repair". Most of .php are "dirty scripts", not well organised but my job is only to move this website and adapt it to php7.

But, I need to find the list of deprecated or incompatible functions from Php 4.4 to Php 7.

Where can I find such a list???

UPDATE:

I've find most of the problems in the main files (most problems are ereg function and mysql -> mysqli). In the same time, I simplified the scripts because the developer used the same function with different name many times (8 times in the same file, with 8 different names -_-) So I've made a function.php where I put all functions and I include it in the files.

It's not easy to work after a dirty developer -_-

like image 396
Amazone Avatar asked Aug 09 '16 11:08

Amazone


People also ask

What is deprecated in php7?

The salt option for the password_hash() function has been deprecated so that the developers do not generate their own (usually insecure) salts. The function itself generates a cryptographically secure salt, when no salt is provided by the developer - thus custom salt generation is not required any more.

What are deprecated functions in PHP?

As a constantly developing language, newer PHP versions include functions that become deprecated. These functions cease to exist or change the expected result of the function as further versions of PHP are released.

Is php7 backwards compatible?

PHP 7 is not backwards compatible.

Is php5 compatible with php7?

You need to be aware that for the most part, PHP 5. x code can run on PHP 7. In PHP 7, there are some backwards incompatible changes, so applications built with PHP 5.


1 Answers

Update: A comment brings up a good point. If you upgrade fully to non-deprecated 5.6 (get rid of any errors and code causing deprecated warnings) you should be able to run under 7 with most likely just Deprecation notices (which you can disable)

First, take a deep breath and figure why you need to upgrade from 4.4 to 7. I can see the immediate value of getting up to a nice still supported 5.6, but 7 is a bit agressive in one sitting (maybe). However, if you'd spartan enough for the challenge....

Got to the release history page and read each release from version 4.4 to whatever version you have available that you're looking to run:

http://php.net/releases/

Each version you care about should have a changlog link. Click on it, search for 'deprecated`.

There are actually only 2 files one changelog for php4 version and one for php 5 version.

  • http://php.net/ChangeLog-4.php
  • http://php.net/ChangeLog-5.php

Heck, if you get ambitious just write a crawler script in php to pull the pages and parse out the deprecated lines.

Once you're through correcting all the php 4 to 5.6 differences, take a look at migrating to php 7 (see my note at the top about running with deprecation notices):

http://php.net/manual/en/migration70.incompatible.php

Though some see it as a negative, PHP has been painfuly rigorous at maintaining quite a lot of backward compatibility, so I don't expect much to be off if you're moving to PHP 5.3 or even 5.4 (around when they started deprecating a bunch of older php stuff).

like image 120
Ray Avatar answered Nov 06 '22 21:11

Ray