stripos(): Argument #1 ($haystack) must be of type string
-
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.php387 /**
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 }
- The topic ‘stripos(): Argument #1 ($haystack) must be of type string’ is closed to new replies.