Hacker News new | ask | show | jobs
by thaJeztah 4512 days ago
I agree completely, maybe PHP should use the same approach as the jQuery migration-plugin, which;

- Logs usage of old or (to-be) deprecated functionality

- Provides deprecated functionality so that existing code doesn't break

This way;

- The PHP API can finally be cleaned up (please, also move those old functions to a separate section in the documentation)

- Older code can still run, but enabling the 'migration/compatibility' plug-in (should be possible to enable/disable this per site, not for the whole server at once)

- Developers are informed that their code uses deprecated functionality, giving them time to migrate code.

Although this approach is comparable to the E_STRICT flag, it is going one step further, in that the deprecated functions are actually removed from the core, and must be manually enabled/added via an optional plugin.

Reorganising the documentation is an important part of this; cleaning up the old stuff will make PHP less confusing (should I use 'implode()' or 'join()'?), and will silently guide new developers away from the old stuff.

On a final note; if this approach allows hosting-providers to upgrade PHP without breaking their client's code, adoption rate of newer PHP versions will probably be faster as well!