Jelajahi Sumber

adding is_array() test to output of get_class_methods()

tokul 20 tahun lalu
induk
melakukan
c47e97e168
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      functions/strings.php

+ 2 - 2
functions/strings.php

@@ -871,8 +871,8 @@ function sm_print_r() {
         if (is_object($var)) {
         if (is_object($var)) {
             // get class methods if $var is object
             // get class methods if $var is object
             $aMethods=get_class_methods(get_class($var));
             $aMethods=get_class_methods(get_class($var));
-            // make sure that array is not empty
-            if ($aMethods!=array()) {
+            // make sure that $aMethods is array and array is not empty
+            if (is_array($aMethods) && $aMethods!=array()) {
                 echo "Object methods:\n";
                 echo "Object methods:\n";
                 foreach($aMethods as $method) {
                 foreach($aMethods as $method) {
                     echo '* ' . $method . "\n";
                     echo '* ' . $method . "\n";