Open diderich opened 6 months ago
can confirm those log entries.
Its caused here: (/app/Session/File.php) around line 106
while ($offset < \strlen($session)) {
if (!strstr(substr($session, $offset), '|')) {
throw new \App\Exceptions\IllegalValue('invalid data, remaining: ' . substr($session, $offset));
}
$pos = strpos($session, '|', $offset);
$num = $pos - $offset;
$varName = substr($session, $offset, $num);
$offset += $num + 1;
$data = unserialize(substr($session, $offset), ['allowed_classes' => false]);
$return[$varName] = $data;
$offset += \strlen(serialize($data));
}
It uses the complete string from $offset position to be de-serialzed. Since only the very next item could be de-serialized it causes that warnings.
Replace those "while" block with (it also does some serialize fixing if parts where missing):
$matches = [];
if(preg_match_all('/(\w+)\|(.*?)(?=(\w+)\||$)/', $session, $matches)) {
foreach($matches[1] as $i=>$k) {
$v = $matches[2][$i];
if(preg_match_all('/s:(\d+):"([^"]*?)"/', $v, $matches2)) {
foreach($matches2[1] as $i=>$len) {
if(($newlen=strlen($matches2[2][$i]))!=$len) {
$v=str_replace("s:{$len}:\"{$matches2[2][$i]}\"","s:{$newlen}:\"{$matches2[2][$i]}\"",$v);
}
}
}
if(substr_count($v, "{")>substr_count($v, "}")) {
$v .= str_repeat("}", substr_count($v, "{")-substr_count($v, "}"));
}
if(!in_array(substr($v,-1), [";","}"])){
$v .= ";";
}
$return[$k] = unserialize($v);
}
}
This worked, thank you
this doesn't allow the user to stay in the portal
I put this in the "while" blocks
Replace those "while" block with (it also does some serialize fixing if parts where missing):
$matches = []; if(preg_match_all('/(\w+)\|(.*?)(?=(\w+)\||$)/', $session, $matches)) { foreach($matches[1] as $i=>$k) { $v = $matches[2][$i]; if(preg_match_all('/s:(\d+):"([^"]*?)"/', $v, $matches2)) { foreach($matches2[1] as $i=>$len) { if(($newlen=strlen($matches2[2][$i]))!=$len) { $v=str_replace("s:{$len}:\"{$matches2[2][$i]}\"","s:{$newlen}:\"{$matches2[2][$i]}\"",$v); } } } if(substr_count($v, "{")>substr_count($v, "}")) { $v .= str_repeat("}", substr_count($v, "{")-substr_count($v, "}")); } if(!in_array(substr($v,-1), [";","}"])){ $v .= ";"; } $return[$k] = unserialize($v); } }
& it allows the user to stay logged in
π bug report
βοΈ Describe the bug
When running the cron job, I get the following warning messages:
The error log file contains a lot of the following type of errors (only a subset is reproduced here):
π₯ How to trigger the error
Steps to reproduce the behavior:
php cron.php
π Actual Behavior
π Expected Behavior
Error messages are saved in
errors.log
andcron/xxxx.log
π· Testing
No errors occur.
π· Screenshot of configuration
π PHP/Apache/Nginx/Browser/CRM Logs
π Your Environment
β Additional context
Add any other context about the problem here.
βοΈ Inform the community if you solve the problem