kamilwylegala / cakephp2-php8

CakePHP 2 fork that supports PHP 8
116 stars 51 forks source link

Resolve PHP deprecation warnings #46

Closed pesek closed 10 months ago

pesek commented 10 months ago

There are many deprecation errors which are suppressed. Suppressing the errors is a viable solution for production, however overall it does not seem like a good practice.

If you turn the error reporting on, there is many errors like the following one: strlen(): Passing null to parameter #1 ($string) of type string is deprecated on every page.

Removing all of the errors might be tedious work but I want to focus on resolving at least the most common.

Deeper explanation / motivation

We have old Cake app that we want to gradually migrate to newever version and in the process we are cutting the monolithic app into pieces, some of them running on different technologies, some of them running on Cake2. We prefer to have the deprecation errors ON because some of the code we are writing now is framework-agnostic and will be ported to more modern tech stack in the future (even PHP9 hopefully) so we want to write the code in a future-proof way. However having dozens of deprecation warnings from Cake2 printed all the time makes this quite uneasy.

Disclaimer

As this is my first issue & PR here, I woud also like to say hi & massive thank you to the author for creating this fork.

Regarding this issue itself, I already have the changes on my machine and will create PR in a moment. I know this issue is very general but I hope to iterate upon this matter and resolve moste of the errors over time as it seems the most convenient way.

kamilwylegala commented 10 months ago

Thank you for reporting this. I'm looking at PR right now.

kamilwylegala commented 10 months ago

PR merged, closing the issue.