Re: Updating legacy code ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/03/2019 19:57, AshleySheridan wrote:
I think most people will agree, using @ to suppress errors is "Not A Good Idea"™. It's also recommended to avoid running with error display on in production environments, but perhaps that's the only way to reliably test with real data? I think we'd all agree that it's rare that a staging/dev environment is a 100% replica of production.

Having said that, you might be able to turn the level of errors down to prevent warnings from being shown. While this will only hide the problem, warnings tend to be limited to things that won't break your application if they don't work entirely as expected.

Having run code that is 'clean' from the start, the second an problem does arise one can see it and my clients can report it. Rather than as WAS often the case, just getting a white page! That is still a problem today with even more things throwing errors and in this case the warning becomes an error in PHP7.3? I'd not anticipated it when somewhat forced to move from 7.0 which I was still working to get everything else clean on.

Without knowing much about your application, this is only a suggestion, but is it possible to replace your arrays with another kind of object that can be iterated? This way, you could have empty instances that can behave themselves better, the empty checks can be moved to the object methods that require them, and your data objects can move towards a more readable and future-proofed structure.

The core of the framework dates back to PHP4 and even today Smarty and ADOdb do not need to be reworked to remove the associative arrays they have worked with stably for years. Trying to re-write the whole of the infrastructure to work with objects is not something I can complete in my remaining lifetime ;) And I don't see a need TO do that when what we have works currently.

The other option is to move the whole of 20+ years of content to a new framework, but even that is not something that can be handled quickly. I've still got some years of content that has not yet even been added because of all the time spent maintaining the framework ...

--
Lester Caine - G8HFL
-----------------------------
Contact - https://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - https://lsces.co.uk
EnquirySolve - https://enquirysolve.com/
Model Engineers Digital Workshop - https://medw.co.uk
Rainbow Digital Media - https://rainbowdigitalmedia.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux