Solving OAuth problems on my blog

Since yesterday it seemed that there occured some errors. Most likely when you tried to login or post a comment. This was due to the OAuth library included with several plugins and all tried to declare the same classes and functions. For now this is solved by adding a class_exist check in the library.

I will lookup the OAuth project and check how we can incorporate these suggestions in to the library.

Old:

class OAuthConsumer {
	public $key;
	public $secret;

	function __construct($key, $secret) {
		$this->key = $key;
		$this->secret = $secret;
	}

	function __toString() {
		return "OAuthConsumer[key=$this->key,secret=$this->secret]";
	}
}

New:

if (!class_exists("OAuthConsumer", false)) {
	class OAuthConsumer {
		public $key;
		public $secret;

		function __construct($key, $secret) {
			$this->key = $key;
			$this->secret = $secret;
		}

		function __toString() {
			return "OAuthConsumer[key=$this->key,secret=$this->secret]";
		}
	}
}

Note lines 1 and 15.