Welcome Guest, Not a member yet? Register   Sign In
Error / Shield 1.0.3 + Ci 4.5.1
#1

Hi everyone,

I followed the documentation proceeding to the installation running the composer command and the php spark setup. I can see the expected files and routes have been added to my application, but when I access /register or /login, I get this error:
Code:
Call to undefined function CodeIgniter\Shield\Authentication\Authenticators\setting()
VENDORPATH/codeigniter4/shield/src/Authentication/Authenticators/Session.php at line 685

Am I missing something? or running into a bug?

@kenjis I know you are working actively on this, thanks Smile I don't want to immediately raise an issue if that's not one, but rather a dumb thing on my end, but let me know if I should
Reply
#2

(This post was last modified: 04-26-2024, 06:29 PM by kenjis.)

I don't know why you get the error,
but do step 2 in Manual Setup:
https://shield.codeigniter.com/getting_s...nual-setup

The error message is "Call to undefined function", that means you call undefined function.
So all you need to do is load the function before calling.
Reply
#3

Thanks, that was it. For some reason the autoload file was not updated during the installation while all the other ones were.
I could understand the message, just not what to do to load it. Did not think of looking at the helpers.
Should i try to reproduce it? My understanding is that the automatic installation was suppose to also take care of the autoload file. I saw no error in the installation logs. But i am happy to explore the “why” this happened.
Reply
#4

Yes, the setup command should add the helpers to the configuration file
or raise an error if it fails to add.
Reply
#5

(04-27-2024, 01:46 AM)kenjis Wrote: Yes, the setup command should add the helpers to the configuration file
or raise an error if it fails to add.

So I saw in my install logs that the message for the autoload update was "Autoload Setup: Everything is fine." rather than "Updated: APPPATH/Config/Autoload.php".
I can reproduce the behaviour easily: I had already some helpers loaded in my autoload file. 
Code:
# if autoload.php has no helper loaded, no problem during install, setting and auth are added
    public $helpers = [];
# if autoload.php already has some helpers loaded, then the file is not updated during the automatic set up and you need to add setting and auth manually 
    public $helpers = [
      'text',
      'form'
   ];

Looks like an unexpected behaviour?
Reply
#6

I've confirmed the bug, and sent a PR to fix it. https://github.com/codeigniter4/shield/pull/1110
Reply
#7

(This post was last modified: 04-28-2024, 12:57 AM by kcs.)

Thanks a lot   Cool
Reply




Theme © iAndrew 2016 - Forum software by © MyBB