Skip to content
This repository
Browse code

Add debugger to SimplePie_Misc::debug()

  • Loading branch information...
commit 48eb37972ba5a02e6231607e0b2f87eb04b4956c 1 parent e87196b
Ryan McCue rmccue authored

Showing 1 changed file with 50 additions and 0 deletions. Show diff stats Hide diff stats

  1. +50 0 SimplePie/Misc.php
50 SimplePie/Misc.php
@@ -2276,5 +2276,55 @@ public static function get_build()
2276 2276 return filemtime(__FILE__);
2277 2277 }
2278 2278 }
  2279 +
  2280 + /**
  2281 + * Format debugging information
  2282 + */
  2283 + public static function debug(&$sp)
  2284 + {
  2285 + $info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n";
  2286 + $info .= 'PHP ' . PHP_VERSION . "\n";
  2287 + if ($sp->error() !== null)
  2288 + {
  2289 + $info .= 'Error occurred: ' . $sp->error() . "\n";
  2290 + }
  2291 + else
  2292 + {
  2293 + $info .= "No error found.\n";
  2294 + }
  2295 + $info .= "Extensions:\n";
  2296 + $extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml');
  2297 + foreach ($extensions as $ext)
  2298 + {
  2299 + if (extension_loaded($ext))
  2300 + {
  2301 + $info .= " $ext loaded\n";
  2302 + switch ($ext)
  2303 + {
  2304 + case 'pcre':
  2305 + $info .= ' Version ' . PCRE_VERSION . "\n";
  2306 + break;
  2307 + case 'curl':
  2308 + $version = curl_version();
  2309 + $info .= ' Version ' . $version['version'] . "\n";
  2310 + break;
  2311 + case 'mbstring':
  2312 + $info .= ' Overloading: ' . mb_get_info('func_overload') . "\n";
  2313 + break;
  2314 + case 'iconv':
  2315 + $info .= ' Version ' . ICONV_VERSION . "\n";
  2316 + break;
  2317 + case 'xml':
  2318 + $info .= ' Version ' . LIBXML_DOTTED_VERSION . "\n";
  2319 + break;
  2320 + }
  2321 + }
  2322 + else
  2323 + {
  2324 + $info .= " $ext not loaded\n";
  2325 + }
  2326 + }
  2327 + return $info;
  2328 + }
2279 2329 }
2280 2330

0 comments on commit 48eb379

Please sign in to comment.
Something went wrong with that request. Please try again.