• aitbelk

    (@aitbelk)


    <span style=”font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;”>Hello WPMobile.App Support Team,</span>

    I am writing to you regarding a persistent PHP Warning that is appearing in my website’s error_log file. The warning originates from your plugin, even though I am running the latest version (v11.75).

    <b>Error Details:</b>

    • <b>Plugin Version:</b> 11.75

    • <b>Full Warning Text:</b>

      <response-element class=”” ng-version=”0.0.0-PLACEHOLDER”><code-block _nghost-ng-c3693737113=”” class=”ng-tns-c3693737113-95 ng-star-inserted”>
      <code _ngcontent-ng-c3693737113="" role="text" data-test-id="code-content" class="code-container formatted ng-tns-c3693737113-95 no-decoration-radius">PHP Warning: Undefined array key "HTTP_HOST" in /wp-content/plugins/wpappninja/inc/functions/seo.php on line 20
      </code-block></response-element>
    • <b>Current Code on Line 20:</b>

      <response-element class=”” ng-version=”0.0.0-PLACEHOLDER”><code-block _nghost-ng-c3693737113=”” class=”ng-tns-c3693737113-96 ng-star-inserted”>
      <span _ngcontent-ng-c3693737113=”” class=”ng-tns-c3693737113-96″>PHP</span>
      <button _ngcontent-ng-c3693737113=”” aria-label=”Copier le code” mat-icon-button=”” mattooltip=”Copier le code” class=”mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c3693737113-96 mat-unthemed ng-star-inserted” mat-ripple-loader-uninitialized=”” mat-ripple-loader-class-name=”mat-mdc-button-ripple” mat-ripple-loader-centered=”” jslog=”179062;track:generic_click,impression;BardVeMetadataKey:[["r_ae1909ecb526c510","c_3f88ab4952f1499d",null,"rc_f7389293806f62ef",null,null,"en",null,1,null,null,1,0]];mutable:true”><span class=”mat-mdc-button-persistent-ripple mdc-icon-button__ripple”></span><mat-icon _ngcontent-ng-c3693737113=”” role=”img” fonticon=”content_copy” class=”mat-icon notranslate google-symbols mat-ligature-font mat-icon-no-color” aria-hidden=”true” data-mat-icon-type=”font” data-mat-icon-name=”content_copy”></mat-icon><span class=”mat-focus-indicator”></span><span class=”mat-mdc-button-touch-target”></span></button>
      <code _ngcontent-ng-c3693737113="" role="text" data-test-id="code-content" class="code-container formatted ng-tns-c3693737113-96"><span class="hljs-variable">$url</span> = <span class="hljs-variable">$_SERVER</span>[<span class="hljs-string">'HTTP_HOST'</span>] . <span class="hljs-variable">$_SERVER</span>[<span class="hljs-string">'REQUEST_URI'</span>];
      </code-block></response-element>
    • <b>Issue:</b> This warning appears when the code is executed via background processes (like WP-Cron), where the HTTP_HOST value is not defined in the $_SERVER array.

    <b>Suggested Solution (to assist with the fix):</b>

    The warning can be avoided by checking for the key’s existence using the Null Coalescing Operator (??):

    <response-element class=”” ng-version=”0.0.0-PLACEHOLDER”><code-block _nghost-ng-c3693737113=”” class=”ng-tns-c3693737113-97 ng-star-inserted”>
    <span _ngcontent-ng-c3693737113=”” class=”ng-tns-c3693737113-97″>PHP</span>
    <button _ngcontent-ng-c3693737113=”” aria-label=”Copier le code” mat-icon-button=”” mattooltip=”Copier le code” class=”mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c3693737113-97 mat-unthemed ng-star-inserted” mat-ripple-loader-uninitialized=”” mat-ripple-loader-class-name=”mat-mdc-button-ripple” mat-ripple-loader-centered=”” jslog=”179062;track:generic_click,impression;BardVeMetadataKey:[["r_ae1909ecb526c510","c_3f88ab4952f1499d",null,"rc_f7389293806f62ef",null,null,"en",null,1,null,null,1,0]];mutable:true”><span class=”mat-mdc-button-persistent-ripple mdc-icon-button__ripple”></span><mat-icon _ngcontent-ng-c3693737113=”” role=”img” fonticon=”content_copy” class=”mat-icon notranslate google-symbols mat-ligature-font mat-icon-no-color” aria-hidden=”true” data-mat-icon-type=”font” data-mat-icon-name=”content_copy”></mat-icon><span class=”mat-focus-indicator”></span><span class=”mat-mdc-button-touch-target”></span></button>
    <code _ngcontent-ng-c3693737113="" role="text" data-test-id="code-content" class="code-container formatted ng-tns-c3693737113-97"><span class="hljs-variable">$url</span> = (<span class="hljs-variable">$_SERVER</span>[<span class="hljs-string">'HTTP_HOST'</span>] ?? <span class="hljs-string">''</span>) . <span class="hljs-variable">$_SERVER</span>[<span class="hljs-string">'REQUEST_URI'</span>];
    </code-block></response-element>

    We kindly request that you include this modification in the next plugin update.

    Thank you for your time and efforts.

    Sincerely,

Viewing 1 replies (of 1 total)
  • Plugin Author Amauri

    (@amauric)

    Can you just paste the error log and not this messy AI text? Thanks !

Viewing 1 replies (of 1 total)

The topic ‘PHP Warning: Undefined array key “HTTP_HOST” in v11.75 – Still Persistent’ is closed to new replies.