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
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?
desireeM
Call that function in a PHP CLI request and you'll get that error.
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?
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.
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.
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.