CodeIgniter Forums
Uses of userdata() without params on Profiler Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Uses of userdata() without params on Profiler Class (/showthread.php?tid=1525)



Uses of userdata() without params on Profiler Class - jpleyjon - 03-18-2015

Hi, I was starting a new project in CI 2.2.x when version 3 comes to live. I follow all the instrucions to migrate from one version to another and it works fine, but when uses profiler. Using Profiler class along with Session class gives me a Warning Error for a use of Session's Class method userdata() without params. I check out the implementation and it does not suppor default params, but in Profiler Class, line 531 is called that method without params. I changed this to $this->CI->session->all_userdata() (I read is an alias of userdata()) an the warning goes away. Is that a bug or am I doing something wrong migrating?


RE: Uses of userdata() without params on Profiler Class - jpleyjon - 03-18-2015

Not a bug at all...My mistake migrating...old Session class was left on libraries folder, because new library class is relocated to ...libraries/session/session.php


RE: Uses of userdata() without params on Profiler Class - mwhitney - 03-18-2015

This seems odd, since the definition of the userdata method clearly shows a default value of NULL on its single argument: https://github.com/bcit-ci/CodeIgniter/blob/4ccc2f80c501d839245915d058f77dea7f1bd3f3/system/libraries/Session/Session.php#L656

The 2.2.1 version of the session library does not include a default value for the argument, though: https://github.com/bcit-ci/CodeIgniter/blob/fe8f13016ee7e07ffe680823b25a84ab14a087d9/system/libraries/Session.php#L448

It seems that you either have a modified session library loading which was written for CI 2.x or you didn't overwrite your 2.2.1 session library with the 3.0rc3 library.


RE: Uses of userdata() without params on Profiler Class - jpleyjon - 03-18-2015

Yes, it was my mistake, I did migration following the steps on the user guide, but it does not mention that Session class was relocated to a folder named Session in libraries folder, so I did overwrite the system folder but I did not delete the old Session class, so CI keep using the old version. I think it could be cleared up in the user guide, just for not so smart people like me Wink


RE: Uses of userdata() without params on Profiler Class - Narf - 03-19-2015

(03-18-2015, 11:50 AM)jpleyjon Wrote: Yes, it was my mistake, I did migration following the steps on the user guide, but it does not mention that Session class was relocated to a folder named Session in libraries folder, so I did overwrite the system folder but I did not delete the old Session class, so CI keep using the old version. I think it could be cleared up in the user guide, just for not so smart people like me  Wink

Overriding stock libraries (as well as using hooks) always comes with the assumption that you know what you're doing and the responsibility for you to follow changes that are internal to the framework. We can't maintain documentation for such things.


RE: Uses of userdata() without params on Profiler Class - zepernick - 03-19-2015

@Narf, I think he is saying that he upgraded CI by copying the CI 3 system files over top of the CI 2 files and it retained the old session class because it was moved in CI 3. Sounds like the best bet would be to delete the CI 2 system folder before copying in CI 3.


RE: Uses of userdata() without params on Profiler Class - jpleyjon - 03-19-2015

@zepernick that's right. I'm just saying that user guide does not mention that session class was relocated, I think you're right, the best way is delete system folder and paste the new file after.


RE: Uses of userdata() without params on Profiler Class - Narf - 03-19-2015

Well, step 1 of the upgrade instructions for all CI releases starts with the following:

Quote:Replace all files and directories in your “system” folder

Smile


RE: Uses of userdata() without params on Profiler Class - jpleyjon - 03-19-2015

@Narf, English is not my mother langague..so I read "replace" and I overwrite system folder, thought it was the same..my bad then..