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.

Tagged: ,

This topic contains 6 replies, has 0 voices.

Last updated by Andrey 1 month, 1 week ago.

Assisted by: Andrey.

Author Posts
April 8, 2025 at 6:39 am #16906897

desireeM

Background of the issue:
PHP 8.3
Warning: Undefined array key "REQUEST_METHOD"
sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/class-wpml-pb-integration.php
in line 170
<code>if ( ! in_array( $_SERVER['REQUEST_METHOD'], [ 'POST', 'PUT', 'PATCH' ], true ) ) {</code>

Seems to happen if this is somehow called in a CLI request.

Fix is simple:
<code>if ( ! isset( $_SERVER['REQUEST_METHOD'] ) || ! in_array( $_SERVER['REQUEST_METHOD'], [ 'POST', 'PUT', 'PATCH' ], true ) ) {</code>

Symptoms:
Warning: Undefined array key "REQUEST_METHOD". I expected to see no PHP Warning, but instead, I got a PHP warning.

Questions:
Fix your code

April 11, 2025 at 12:08 pm #16922589

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for contacting WPML support and bringing this issue to our attention.

Could you please provide some detailed steps to replicate the problem so I can further report this to our development team?

April 15, 2025 at 8:26 am #16932377

desireeM

Call that function in a PHP CLI request and you'll get that error.

April 15, 2025 at 6:21 pm #16935820

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback. I am receiving mixed results. Can you show me exactly how you called it? Or could you elaborate a bit more so I can replicate it?

April 22, 2025 at 5:47 am #16953029

desireeM

>Can you show me exactly how you called it? Or could you elaborate a bit more so I can replicate it?

What about
>Call that function in a PHP CLI request and you'll get that error.

is unclear?

I already provided the fix for you even.

Sorry, but you're providing the software not me. I expect a minimum knowledge of PHP at least, bc this is wasting my time.

April 22, 2025 at 11:26 am #16954907

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback.

I will share this information with our team.

April 23, 2025 at 11:28 am #16959288

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I appreciate bringing this to our attention. It will be reported to our development team.