Permalink
Browse files

Add backwards compatibility for removed methods

This stubs out subscribe_*() and enable_xml_dump()
  • Loading branch information...
rmccue committed Oct 30, 2012
1 parent 7e6ae7c commit 8bc4e02b4084fb80df4ac10859dca4d651677a1b
Showing with 29 additions and 0 deletions.
  1. +29 −0 library/SimplePie.php
View
@@ -2953,6 +2953,35 @@ public function get_favicon()
return false;
}
+ /**
+ * Magic method handler
+ *
+ * @param string $method Method name
+ * @param array $args Arguments to the method
+ * @return mixed
+ */
+ public function __call($method, $args)
+ {
+ if (strpos($method, 'subscribe_') === 0)
+ {
+ $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+ trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level);
+ return '';
+ }
+ if ($method === 'enable_xml_dump')
+ {
+ $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+ trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level);
+ return false;
+ }
+
+ $class = get_class($this);
+ $trace = debug_backtrace();
+ $file = $trace[0]['file'];
+ $line = $trace[0]['line'];
+ trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR);
+ }
+
/**
* Sorting callback for items
*

0 comments on commit 8bc4e02

Please sign in to comment.