CodeIgniter Forums
Application broken after upgrading from v4.03 to v4.0.4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Application broken after upgrading from v4.03 to v4.0.4 (/thread-77056.html)



Application broken after upgrading from v4.03 to v4.0.4 - seunex - 07-15-2020

Well i just upgrade from 4.0.3 to latest released 4.0.4 and my Filter class broken.

[Image: cbd3d6ee0133ffe5e34a15cba0f6b283.png]


RE: Application broken after upgrading from v4.03 to v4.0.4 - John_Betong - 07-15-2020

It is not easy to replicate the problem.

Can you please copy and paste details of the error and enclose the script inside
Quote: // Error messages go here
or preferably
PHP Code:
// script goes here 



RE: Application broken after upgrading from v4.03 to v4.0.4 - seunex - 07-15-2020

(07-15-2020, 11:17 PM)John_Betong Wrote: It is not easy to replicate the problem.

Can you please copy and paste details of the error and enclose the script inside
Quote: // Error messages go here
or preferably
PHP Code:
// script goes here 

Fixed! Buth codeigniter should put a proper upgrade guild next time.
Fixed solution here.
in version 4.0.3 we declare our filter before function by using.


PHP Code:
public function before(RequestInterface $request)
{
 
//code here


But in version 4.0.4 i need to add $arguments = null to the param



PHP Code:
public function before(RequestInterface $request$arguments null)
{
   
// code here




RE: Application broken after upgrading from v4.03 to v4.0.4 - InsiteFX - 07-16-2020

It was in the change log:

Added $arguments parameter to after() and before() in FilterInterface. This is a breaking change, so all code implementing the FilterInterface must be updated


RE: Application broken after upgrading from v4.03 to v4.0.4 - born2webdesign - 07-16-2020

(07-16-2020, 02:13 AM)InsiteFX Wrote: This is a breaking change

SRY, slightly OT:
(Being new to CI) While it’s always a good idea to read the change log, are breaking changes to be expected for bugfix releases?
Or doesn’t CI use SemVer and the version number only looks like it?


RE: Application broken after upgrading from v4.03 to v4.0.4 - wdeda - 07-16-2020

(07-16-2020, 02:13 AM)InsiteFX Wrote: It was in the change log:

Added $arguments parameter to after() and before() in FilterInterface. This is a breaking change, so all code implementing the FilterInterface must be updated

In the update the following error occurred:
Fatal error: Uncaught Error: Call to undefined function CodeIgniter \ locale_set_default () in C: \ wwwroot \ system \ CodeIgniter.php: 184 Stack trace: # 0 C: \ wwwroot \ system \ bootstrap.php (181): CodeIgniter \ CodeIgniter -> initialize () # 1 C: \ wwwroot \ index.php (36): require ('C: \\ wwwroot \\ syst ...') # 2 {main} thrown in C: \ wwwroot \ system \ CodeIgniter .php online 184
The line was commented and the problem solved:

//locale_set_default ($ this-> config-> defaultLocale ?? 'en');


RE: Application broken after upgrading from v4.03 to v4.0.4 - tgix - 07-16-2020

(07-16-2020, 04:45 AM)born2webdesign Wrote:
(07-16-2020, 02:13 AM)InsiteFX Wrote: This is a breaking change

SRY, slightly OT:
(Being new to CI) While it’s always a good idea to read the change log, are breaking changes to be expected for bugfix releases?
Or doesn’t CI use SemVer and the version number only looks like it?
As the author of this fix I'd like to chime in with a question to this:

My first attempt of fixing this was by adding an additional interface FilterInterfaceWithArguments since I didn't like the idea of messing with interfaces and breaking existing code. Adding a new interface had the pros of not breaking existing code, but the cons of adding complexity to the framework with basically this interfaces for the same thing, but one interface working as described in the docs. 
By fixing the bug this way the framework was kept clean and the bug was fixed.

So, my question: since SemVer §8 states that "Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API."
should the fix either have been
a) a new interface or
b) a release of CI 5.0.0?

As a side note I'd like to see the re-introduction of the minor upgrade docs from CI3.

/Mattias




RE: Application broken after upgrading from v4.03 to v4.0.4 - paulbalandan - 07-16-2020

(07-16-2020, 06:26 AM)wdeda Wrote:
(07-16-2020, 02:13 AM)InsiteFX Wrote: It was in the change log:

Added $arguments parameter to after() and before() in FilterInterface. This is a breaking change, so all code implementing the FilterInterface must be updated

In the update the following error occurred:
Fatal error: Uncaught Error: Call to undefined function CodeIgniter \ locale_set_default () in C: \ wwwroot \ system \ CodeIgniter.php: 184 Stack trace: # 0 C: \ wwwroot \ system \ bootstrap.php (181): CodeIgniter \ CodeIgniter -> initialize () # 1 C: \ wwwroot \ index.php (36): require ('C: \\ wwwroot \\ syst ...') # 2 {main} thrown in C: \ wwwroot \ system \ CodeIgniter .php online 184
The line was commented and the problem solved:

//locale_set_default ($ this-> config-> defaultLocale ?? 'en');

You should have the PHP intl extension installed in your machine.