Jump to content

Error: "Warning: unserialize() expects parameter 1 to be string, array given"


Recommended Posts

Cordial Saludo, espero que alguien pueda ayudarme.

He realizado la actualización de prestashop usando el módulo de "Actualización con un Click" de prestashop, desde la versión 1.4 hasta la 1.7, arreglando todo tipo de errores posibles en cuanto a bases de datos, ya que al parecer no transforma bien los esquemas de las tablas y sino es por otros errores.

Hoy quiero pedirles ayuda, para terminar mi labor de actualización, si alguien conoce como solucionar este error cuando intento ingresar a algunas opciones de configuración (ejemplo: "http://mitienda.com/adminsen/index.php/configure/shop/seo-urls/" ) :

 

Warning: unserialize() expects parameter 1 to be string, array given

Symfony\Component\Debug\Exception\ ContextErrorException

in vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authentication\Token\AbstractToken.php (line 155)

 

    /**

     * {@inheritdoc}

     */

    public function unserialize($serialized)

    {

        list($this->user, $this->authenticated, $this->roles, $this->attributes) = unserialize($serialized);

    }

    /**

     * Returns the token attributes.

     *

 

Parece un error de módulos o de permisos en ellos, he intentado corregirlo colocando los modulos como inactivos, el algunas ocasiones o para algunas opciones funciona en otras no.

Si alguien sabe como solucionarlo le agradezco el aporte.

 

Warning_unserialize()_expects_parameter_1_to_be_string,_array_given_(500_Internal_Server_Error)_-_2019-08-30_09.43.19.png

Warning_unserialize()_expects_parameter_1_to_be_string,_array_given_(500_Internal_Server_Error)_-_2019-08-30_09.43.55.png

Warning_unserialize()_expects_parameter_1_to_be_string,_array_given_(500_Internal_Server_Error)_-_2019-08-30_09.52.26.png

Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...
En 4/6/2020 a las 11:59 PM, tapanda.gr dijo:

Have you found the solution? I am facing the same issue.

No, no me fue posible encontrar una solución facil. Aunque podria decirse que el modulo de actualización de prestashop falla al momento de modificar algunas estructuras de datos, probablemente porque se contiene información que no es compatible con la nueva estructura o en su momento el sistema ha omitido esa tabla, como lo son las tablas de estadisticas, que particularmente no las uso pero que vienen cargado con datos por defecto o quizas desactivamos esos modulos luego de usar nuestra tienda, en fin, es solo un ejemplo de algo que puede que sea asi.

Lo que hice al fina, luego de muchas pruebas y errores, y después de lograr pasar de la 1.4 a la 1.5 o 1.6, solucionando muchos problemas, encontré una herramienta eficaz, es un migrador de datos, cortesía de Víctor Ródenas un miembro de estos foros, te dejo el enlace a la página donde encontrarás más información.

https://victor-rodenas.com/migrar-datos-de-prestashop-1-4-1-5-1-6-a-la-version-1-7/

 

PD.: si buscas solucionar el error ante una actualización, pues antes recomiendo siempre hacer una copia de respaldo de la tienda (archivos y bases de datos), luego solo compara la estructura de las tablas entre tu versión y una versión limpia, así encontrarás que el actualizador omite ciertas cosas para avanzar, pero que al final cuando la plataforma las necesita habrán errores por las estructuras (tipos de datos, orden de columnas y llaves).

Link to comment
Share on other sites

  • 9 months later...

I get this same error with a PS 1.7.3.3 original on PHP 7.1.

The weird thing is when I look at the errors. The first four entries seem meaningless repeats of "object(role)" but the fifth item starts with "at UsernamePasswordToken->unserialize('a:3:{i:0;". 

I guess it should contain the username with which I logged into the backoffice. However, in this case it showed the email address to login to a different shop on the same server - in which I had just logged in. Note that this is a XAMPP installation and each of the shops is in a subdirectory from localhost.

This error happened only on this common server. On the server where this shop was installed standalone (with PHP 5.6) there was no problem.

Edited by musicmaster (see edit history)
Link to comment
Share on other sites

I had a look at Prestashop 1.7.7.1. There this function in AbstractToken.php looks slightly different. I implemented the new variety and the error disappeared.

So the old version is:

    public function unserialize($serialized)
    { 
        list($this->user, $this->authenticated, $this->roles, $this->attributes) = unserialize($serialized);
    }

And the new version is:

    public function unserialize($serialized)
    {
        list($this->user, $this->authenticated, $this->roles, $this->attributes) = \is_array($serialized) ? $serialized : unserialize($serialized);
    }

The full path of the file is /vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

It may well be that this Prestashop "fix" only hides the real problem. But at least it makes all functions in the backoffice accessible again.

Edited by musicmaster (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...