Welcome Guest, Not a member yet? Register   Sign In
Application broken after upgrading from v4.03 to v4.0.4
#1

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

[Image: cbd3d6ee0133ffe5e34a15cba0f6b283.png]
Reply
#2

(This post was last modified: 07-15-2020, 11:20 PM by John_Betong.)

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 
Reply
#3

(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

Reply
#4

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
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(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?
Reply
#6

(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');
Reply
#7

(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

Reply
#8

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB