Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Toolbar causes error if an array is provided as session value since Beta 2 #1919

Closed
fijas opened this issue Apr 7, 2019 · 2 comments
Closed

Comments

@fijas
Copy link
Contributor

fijas commented Apr 7, 2019


name: Bug report
about: Help us improve the framework by reporting bugs!


Describe the bug
If I set an array as a session value, the Debug Toolbar causes the following error:

preg_match() expects parameter 2 to be string, array given

SYSTEMPATH/Debug/Toolbar.php at line 144

143                 // Replace the binary data with string to avoid json_encode failure.
144                 if (preg_match('~[^\x20-\x7E\t\r\n]~', $value))
145                 {
146                     $value = 'binary data';
147                 }

Probably related to this issue #1779 and it's fix. This was working in beta 1 iirc.

CodeIgniter 4 version
4.0.0-beta.2

Affected module(s)
Debug Toolbar

Expected behavior, and steps to reproduce if appropriate
The Debug Toolbar should just display the array properly.

It should be easily reproducible by setting a nested array as a session value:

$arr = [
   'a' => 1,
   'b' => [2, 3, 4]
];
session()->set($arr);

Context

  • OS: Ubuntu Server
  • Web server: Apache 2
  • PHP version: 7.2
@atishhamte
Copy link
Contributor

@fijas, could you check with the changes done in PR, whether it solves your problem or not.

@fijas
Copy link
Contributor Author

fijas commented Apr 8, 2019

@atishamte Yes, that seems to fix it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants