Jump to content

Recommended Posts

Posted

Hello! I'm suddenly getting the following error on my first login to admin, when installing/uninstalling a module and when checking for new module updates through ProcessWireUpgrade module.

PHP Deprecated:  htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in C:\laragon\www\mysite\wire\core\LanguageFunctions.php on line 232

The line 232 of wire\core\LanguageFunctions.php has this:

if($encode) $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $encode === true);

And when this error happens, the main admin menu links Pages, Setup, Modules, Access are gone. 

EDIT: The following code on my template for creating user is causing that weird issue:

// Check if order is paid
if($order->pad_paid) {

    // Save new user
    if($user->isGuest()) {

        $u = $users->add($order->email);
        $u->email = $order->email;
        $u->pass = $order->pass;
        $u->ip_address = $order->pad_ip_address;
        $u->addRole("login-register");
        $u->save();

        // Save user to the order page
        $order->setAndSave([
            'pad_user' => $u->id
        ]);

    }

}

 

Posted

It's on localhost with ProcessWire 3.0.251 and PHP 8.3.9. I've imported yesterday's db backup and the problem is gone.

I did 2 things today, creating a custom process module and creating a user from api. The module doesn't cause any issue so I repeated the process of creating a user from the api and it seems that is causing the issue.

Why the following code is causing that weird issue???

// Check if order is paid
if($order->pad_paid) {

    // Save new user
    if($user->isGuest()) {

        $u = $users->add($order->email);
        $u->email = $order->email;
        $u->pass = $order->pass;
        $u->ip_address = $order->pad_ip_address;
        $u->addRole("login-register");
        $u->save();

        // Save user to the order page
        $order->setAndSave([
            'pad_user' => $u->id
        ]);

    }

}

 

  • PWaddict changed the title to Creating user from api causes a weird issue
Posted

Ok found why this is happening. The code is fine as I was I able to create a user from a different template and there was no problem. I'm creating a user when order through Padloper (v1) is completed.

Few days ago I've renamed the page name "padloper" from the related admin page that displays the orders and since that name is hardcoded on Padloper module that's why I was getting that weird issue.

  • PWaddict changed the title to [SOLVED] Creating user from api causes a weird issue

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...