Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+01:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by desireeM 2 months, 2 weeks ago.

Assisted by: Bruno Kos.

Author Posts
August 29, 2024 at 9:33 pm #16122255

desireeM

Background of the issue:
WPML 4.6.13
sitepress-multilingual-cmsclassesrequest-handlingclass-wpml-language-per-domain-sso.php

You have this code:
`if ( ! apply_filters( 'send_auth_cookies', true ) ) {`

But in wp-includes/pluggable.php there is:
`if ( ! apply_filters( 'send_auth_cookies', true, $expire, $expiration, $user_id, $scheme, $token ) ) {`

If any plugin add_filter on "send_auth_cookies" hook, e.g.

```
add_filter( 'send_auth_cookies', 'are_cookies_allowed', 10, 4 );
function are_cookies_allowed( $filterable, $expire, $expiration, $user_id ) {
```

The site doesn't work and you get a fatal error. You need to pass all args like WP core when re-using WP core hooks in your plugin.

Symptoms:
Fatal error because WPML send_auth_cookies filter has too few arguments. The site doesn't work and you get a fatal error.

Questions:
Fix this

September 2, 2024 at 5:44 am #16129965

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Thank you for contacting WPML support!

So this happens when you use domain per language only? Can you send me a full error message with a call stack?

Regards,
Bruno Kos

September 2, 2024 at 6:46 am #16130078

desireeM

In PHP 7.4+ (including 8+) we get:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function my_callback(), 1 passed in ....php on line x and exactly 4 expected in ...

We get this whenever this class is loaded - it seems only if language per domain SSO is used from the class name.

September 2, 2024 at 9:24 am #16130717

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

This is escalated to WPML developers team.

I will keep this thread updated, but possibly the solution will be that we use

		if ( ! apply_filters( 'send_auth_cookies', true, $expire, $expiration, $user_id, $scheme, $token ) ) {
			return;
		}

in our code.

September 2, 2024 at 9:59 am #16130817

desireeM

Exactly that's the solution