• Resolved stevenlia

    (@stevenlia)


    I got an error in “Advanced Tools” tab, it’s php version: phpinfo

    as described below
    PHP Fatal error (TypeError) has occurred during phpinfo subaction.
    stripos(): Argument #1 ($haystack) must be of type string, array given (Code: 0, line 405 in /var/www/html/wp-content/plugins/updraftplus/includes/class-wpadmin-commands.php

    387 /**
    388 * N.B. Not exactly the same as the phpinfo method in the UpdraftCentral core class
    389 * Returns a string, as it is directly fetched as the source of an iframe
    390 *
    391 * @return String – returns the resulting HTML
    392 */
    393 public function phpinfo() {
    394
    395 ob_start();
    396
    397 if (function_exists(‘phpinfo’)) phpinfo(INFO_ALL ^ (INFO_CREDITS | INFO_LICENSE));
    398
    399 echo ‘<h3 id=”ud-debuginfo-constants”>’.__(‘Constants’, ‘updraftplus’).'</h3>’;
    400 $opts = @get_defined_constants();// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
    401 ksort($opts);
    402 echo ‘<table><thead></thead><tbody>’;
    403 foreach ($opts as $key => $opt) {
    404 // Administrators can already read these in other ways, but we err on the side of caution
    405 if (false !== stripos($opt, ‘api_key’)) $opt = ‘***’;
    406 echo ‘<tr><td>’.htmlspecialchars($key).'</td><td>’.htmlspecialchars(print_r($opt, true)).'</td>’;
    407 }
    408 echo ‘</tbody></table>’;
    409
    410 $ret = ob_get_contents();
    411 ob_end_clean();
    412
    413 return $ret;
    414
    415 }

    I try to fix the code and add html style

    387 /**
    388 * N.B. Not exactly the same as the phpinfo method in the UpdraftCentral core class
    389 * Returns a string, as it is directly fetched as the source of an iframe
    390 *
    391 * @return String – returns the resulting HTML
    392 */
    393 public function phpinfo() {
    394
    395 ob_start();
    396
    397 if (function_exists(‘phpinfo’)) phpinfo(INFO_ALL ^ (INFO_CREDITS | INFO_LICENSE));
    398
    399 echo ‘<div class=”center”>’;
    400 echo ‘<h2 id=”ud-debuginfo-constants”>’.__(‘Constants’, ‘updraftplus’).'</h3>’;
    401 $opts = @get_defined_constants();// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
    402 ksort($opts);
    403 echo ‘<table><thead></thead><tbody><tr class=”h”><th>Variable</th><th>Value</th></tr>‘;
    404 foreach ($opts as $key => $opt) {
    405 // Administrators can already read these in other ways, but we err on the side of caution
    406 if (false !== stripos(strval($opt), ‘api_key’)) $opt = ‘***’;
    407 echo ‘<tr><td class=”e”>’.htmlspecialchars($key).'</td><td class=”v”>’.htmlspecialchars(print_r($opt, true)).'</td>’;
    408 }
    409 echo ‘</tbody></table></div>‘;
    410
    411 $ret = ob_get_contents();
    412 ob_end_clean();
    413
    414 return $ret;
    415
    416 }

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor bcrodua

    (@bcrodua)

    Hi,

    Please can you confirm the plugin version you are using?

    Thanks,
    Bryle

    Thread Starter stevenlia

    (@stevenlia)

    Hi, bcrodua
    My UpdraftPlus – Backup/Restore plugin version is 1.16.56

    Plugin Contributor bcrodua

    (@bcrodua)

    Hi,

    Have you already tried re-installing the plugin? Do you get the same result?

    May I also know the PHP version used, please? I’ll consult one of our colleagues about the error too.

    Thanks,
    Bryle

    Plugin Author David Anderson / Team Updraft

    (@davidanderson)

    Hi,

    I have committed a fix to our development version for this – it will be in our next release. Thank you for the report!

    David

    Thread Starter stevenlia

    (@stevenlia)

    Hi, David

    Thank you for helping to fix the code!

    Steven

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘stripos(): Argument #1 ($haystack) must be of type string’ is closed to new replies.