• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

phplinuxcodeignitersession


PHP Snippet 1:

$recalculated_data = preg_replace_callback( '!s:(\d+):"(.*?)";!', function( $match ) {      
    return ( $match[1] == strlen( $match[2] ) ) ? $match[0] : 's:' . strlen( $match[2] ) . ':"' . $match[2] . '";';
}, $data );

unserialize( $recalculated_data );

Related Snippets

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

Custom API and cunsuming in php?

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

Nginx RTMP not recording

Group data in a multidimensional array based on two columns

Correct way to use LIKE '%{$var}%' with prepared statements?

Results page in other window

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

How to reset Laravel AuthManager/guards in between API calls in tests?

How to auto populate preferredCountries from intl-tel-input with db output

How to make dot match newline characters using regular expressions

Laravel 8: Array to string conversion while calling route:list

Symfony - "framework.test" config is not set to true

Converting array to string and then back in PHP

About Contact Privacy policy Terms and conditions