Fixed bug #12455: OpenID authentication does not work with PHP 5.3
authorRupert Germann <rupi@gmx.li>
Tue, 17 Nov 2009 16:25:13 +0000 (16:25 +0000)
committerRupert Germann <rupi@gmx.li>
Tue, 17 Nov 2009 16:25:13 +0000 (16:25 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6451 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/openid/lib/php-openid/Auth/OpenID/AX.php
typo3/sysext/openid/lib/php-openid/Auth/OpenID/Association.php
typo3/sysext/openid/lib/php-openid/Auth/OpenID/BigMath.php
typo3/sysext/openid/lib/php-openid/Auth/OpenID/Consumer.php
typo3/sysext/openid/lib/php-openid/Auth/OpenID/Discover.php
typo3/sysext/openid/lib/php-openid/Auth/OpenID/Server.php
typo3/sysext/openid/lib/php-openid/Auth/Yadis/XRDS.php
typo3/sysext/openid/lib/php-openid/Auth/Yadis/XRIRes.php
typo3/sysext/openid/lib/php-openid/Auth/Yadis/Yadis.php
typo3/sysext/openid/sv1/class.tx_openid_sv1.php

index 73ae5f6..731a248 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-17  Rupert Germann  <rupi@gmx.li>
+
+       * Fixed bug #12455: OpenID authentication does not work with PHP 5.3
+
 2009-11-17  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #12612: Backend Login-Popup not working
index 4a617ae..107f52b 100644 (file)
@@ -235,7 +235,7 @@ class Auth_OpenID_AX_AttrInfo {
  * return null If an alias is present in the list of aliases but
  * is not present in the namespace map.
  */
-function Auth_OpenID_AX_toTypeURIs(&$namespace_map, $alias_list_s)
+function Auth_OpenID_AX_toTypeURIs($namespace_map, $alias_list_s)
 {
     $uris = array();
 
@@ -573,7 +573,7 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
      * @param type_uri: The URI for the attribute
      * @param values: A list of values to send for this attribute.
      */
-    function setValues($type_uri, &$values)
+    function setValues($type_uri, $values)
     {
         $this->data[$type_uri] =& $values;
     }
@@ -587,7 +587,7 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
      *
      * @access private
      */
-    function _getExtensionKVArgs(&$aliases)
+    function _getExtensionKVArgs($aliases)
     {
         if ($aliases === null) {
             $aliases = new Auth_OpenID_NamespaceMap();
@@ -888,7 +888,7 @@ class Auth_OpenID_AX_FetchResponse extends Auth_OpenID_AX_KeyValueMessage {
             $ax_args['update_url'] = $update_url;
         }
 
-        Auth_OpenID::update(&$ax_args, $kv_args);
+        Auth_OpenID::update($ax_args, $kv_args);
 
         return $ax_args;
     }
@@ -960,7 +960,7 @@ class Auth_OpenID_AX_StoreRequest extends Auth_OpenID_AX_KeyValueMessage {
     {
         $ax_args = $this->_newArgs();
         $kv_args = $this->_getExtensionKVArgs($aliases);
-        Auth_OpenID::update(&$ax_args, $kv_args);
+        Auth_OpenID::update($ax_args, $kv_args);
         return $ax_args;
     }
 }
index 37ce0cb..83bdd98 100644 (file)
@@ -327,7 +327,7 @@ class Auth_OpenID_Association {
      *
      * @access private
      */
-    function _makePairs(&$message)
+    function _makePairs($message)
     {
         $signed = $message->getArg(Auth_OpenID_OPENID_NS, 'signed');
         if (!$signed || Auth_OpenID::isFailure($signed)) {
@@ -352,7 +352,7 @@ class Auth_OpenID_Association {
      *
      * @access private
      */
-    function getMessageSignature(&$message)
+    function getMessageSignature($message)
     {
         $pairs = $this->_makePairs($message);
         return base64_encode($this->sign($pairs));
@@ -364,7 +364,7 @@ class Auth_OpenID_Association {
      *
      * @access private
      */
-    function checkMessageSignature(&$message)
+    function checkMessageSignature($message)
     {
         $sig = $message->getArg(Auth_OpenID_OPENID_NS,
                                 'sig');
index 4510494..3392343 100644 (file)
@@ -365,6 +365,7 @@ function Auth_OpenID_math_extensions()
 function Auth_OpenID_detectMathLibrary($exts)
 {
     $loaded = false;
+    $hasDl = function_exists('dl');
 
     foreach ($exts as $extension) {
         // See if the extension specified is already loaded.
@@ -374,7 +375,7 @@ function Auth_OpenID_detectMathLibrary($exts)
         }
 
         // Try to load dynamic modules.
-        if (!$loaded) {
+        if (!$loaded && $hasDl) {
             foreach ($extension['modules'] as $module) {
                 if (@dl($module . "." . PHP_SHLIB_SUFFIX)) {
                     $loaded = true;
index e823255..c9f6992 100644 (file)
@@ -258,7 +258,7 @@ class Auth_OpenID_Consumer {
      * when creating the internal consumer object.  This is used for
      * testing.
      */
-    function Auth_OpenID_Consumer(&$store, $session = null,
+    function Auth_OpenID_Consumer($store, $session = null,
                                   $consumer_cls = null)
     {
         if ($session === null) {
@@ -268,9 +268,9 @@ class Auth_OpenID_Consumer {
         $this->session =& $session;
 
         if ($consumer_cls !== null) {
-            $this->consumer =& new $consumer_cls($store);
+            $this->consumer = new $consumer_cls($store);
         } else {
-            $this->consumer =& new Auth_OpenID_GenericConsumer($store);
+            $this->consumer = new Auth_OpenID_GenericConsumer($store);
         }
 
         $this->_token_key = $this->session_key_prefix . $this->_token_suffix;
@@ -281,7 +281,7 @@ class Auth_OpenID_Consumer {
      *
      * @access private
      */
-    function getDiscoveryObject(&$session, $openid_url,
+    function getDiscoveryObject($session, $openid_url,
                                 $session_key_prefix)
     {
         return new Auth_Yadis_Discovery($session, $openid_url,
@@ -611,7 +611,7 @@ class Auth_OpenID_GenericConsumer {
      * in the module description.  The default value is False, which
      * disables immediate mode.
      */
-    function Auth_OpenID_GenericConsumer(&$store)
+    function Auth_OpenID_GenericConsumer($store)
     {
         $this->store =& $store;
         $this->negotiator =& Auth_OpenID_getDefaultNegotiator();
@@ -665,14 +665,14 @@ class Auth_OpenID_GenericConsumer {
         $method = Auth_OpenID::arrayGet($mode_methods, $mode,
                                         '_completeInvalid');
 
-        return call_user_func_array(array(&$this, $method),
+        return call_user_func_array(array($this, $method),
                                     array($message, $endpoint, $return_to));
     }
 
     /**
      * @access private
      */
-    function _completeInvalid($message, &$endpoint, $unused)
+    function _completeInvalid($message, $endpoint, $unused)
     {
         $mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode',
                                  '<No mode set>');
@@ -684,7 +684,7 @@ class Auth_OpenID_GenericConsumer {
     /**
      * @access private
      */
-    function _complete_cancel($message, &$endpoint, $unused)
+    function _complete_cancel($message, $endpoint, $unused)
     {
         return new Auth_OpenID_CancelResponse($endpoint);
     }
@@ -692,7 +692,7 @@ class Auth_OpenID_GenericConsumer {
     /**
      * @access private
      */
-    function _complete_error($message, &$endpoint, $unused)
+    function _complete_error($message, $endpoint, $unused)
     {
         $error = $message->getArg(Auth_OpenID_OPENID_NS, 'error');
         $contact = $message->getArg(Auth_OpenID_OPENID_NS, 'contact');
@@ -705,7 +705,7 @@ class Auth_OpenID_GenericConsumer {
     /**
      * @access private
      */
-    function _complete_setup_needed($message, &$endpoint, $unused)
+    function _complete_setup_needed($message, $endpoint, $unused)
     {
         if (!$message->isOpenID2()) {
             return $this->_completeInvalid($message, $endpoint);
@@ -719,7 +719,7 @@ class Auth_OpenID_GenericConsumer {
     /**
      * @access private
      */
-    function _complete_id_res($message, &$endpoint, $return_to)
+    function _complete_id_res($message, $endpoint, $return_to)
     {
         $user_setup_url = $message->getArg(Auth_OpenID_OPENID1_NS,
                                            'user_setup_url');
@@ -1178,6 +1178,8 @@ class Auth_OpenID_GenericConsumer {
      */
     function _discoverAndVerify($claimed_id, $to_match_endpoints)
     {
+
+
         // oidutil.log('Performing discovery on %s' % (claimed_id,))
         list($unused, $services) = call_user_func($this->discoverMethod,
                                                   $claimed_id,
@@ -1197,7 +1199,7 @@ class Auth_OpenID_GenericConsumer {
      * @access private
      */
     function _verifyDiscoveryServices($claimed_id,
-                                      &$services, &$to_match_endpoints)
+                                      $services, $to_match_endpoints)
     {
         // Search the services resulting from discovery to find one
         // that matches the information from the assertion
@@ -1460,7 +1462,7 @@ class Auth_OpenID_GenericConsumer {
      *
      * @access private
      */
-    function _extractSupportedAssociationType(&$server_error, &$endpoint,
+    function _extractSupportedAssociationType($server_error, $endpoint,
                                               $assoc_type)
     {
         // Any error message whose code is not 'unsupported-type'
@@ -1565,7 +1567,7 @@ class Auth_OpenID_GenericConsumer {
     /**
      * @access private
      */
-    function _extractAssociation(&$assoc_response, &$assoc_session)
+    function _extractAssociation($assoc_response, $assoc_session)
     {
         // Extract the common fields from the response, raising an
         // exception if they are not found
@@ -1747,7 +1749,7 @@ class Auth_OpenID_AuthRequest {
      * class.  Instances of this class are created by the library when
      * needed.
      */
-    function Auth_OpenID_AuthRequest(&$endpoint, $assoc)
+    function Auth_OpenID_AuthRequest($endpoint, $assoc)
     {
         $this->assoc = $assoc;
         $this->endpoint =& $endpoint;
@@ -1763,7 +1765,7 @@ class Auth_OpenID_AuthRequest {
      * $extension_request: An object that implements the extension
      * request interface for adding arguments to an OpenID message.
      */
-    function addExtension(&$extension_request)
+    function addExtension($extension_request)
     {
         $extension_request->toMessage($this->message);
     }
@@ -2226,4 +2228,4 @@ class Auth_OpenID_SetupNeededResponse extends Auth_OpenID_ConsumerResponse {
     }
 }
 
-?>
+?>
\ No newline at end of file
index 62aeb1d..f3f71e4 100644 (file)
@@ -305,7 +305,7 @@ function Auth_OpenID_findOPLocalIdentifier($service, $type_uris)
     return $local_id;
 }
 
-function filter_MatchesAnyOpenIDType(&$service)
+function filter_MatchesAnyOpenIDType($service)
 {
     $uris = $service->getTypes();
 
@@ -415,7 +415,7 @@ function Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services)
     return $s;
 }
 
-function Auth_OpenID_discoverWithYadis($uri, &$fetcher,
+function Auth_OpenID_discoverWithYadis($uri, $fetcher,
               $endpoint_filter='Auth_OpenID_getOPOrUserServices',
               $discover_function=null)
 {
@@ -433,7 +433,7 @@ function Auth_OpenID_discoverWithYadis($uri, &$fetcher,
     $openid_services = array();
 
     $response = call_user_func_array($discover_function,
-                                     array($uri, &$fetcher));
+                                     array($uri, $fetcher));
 
     $yadis_url = $response->normalized_uri;
     $yadis_services = array();
@@ -460,18 +460,18 @@ function Auth_OpenID_discoverWithYadis($uri, &$fetcher,
     }
 
     $openid_services = call_user_func_array($endpoint_filter,
-                                            array(&$openid_services));
+                                            array($openid_services));
 
     return array($yadis_url, $openid_services);
 }
 
-function Auth_OpenID_discoverURI($uri, &$fetcher)
+function Auth_OpenID_discoverURI($uri, $fetcher)
 {
     $uri = Auth_OpenID::normalizeUrl($uri);
     return Auth_OpenID_discoverWithYadis($uri, $fetcher);
 }
 
-function Auth_OpenID_discoverWithoutYadis($uri, &$fetcher)
+function Auth_OpenID_discoverWithoutYadis($uri, $fetcher)
 {
     $http_resp = @$fetcher->get($uri);
 
@@ -490,7 +490,7 @@ function Auth_OpenID_discoverWithoutYadis($uri, &$fetcher)
     return array($identity_url, $openid_services);
 }
 
-function Auth_OpenID_discoverXRI($iname, &$fetcher)
+function Auth_OpenID_discoverXRI($iname, $fetcher)
 {
     $resolver = new Auth_Yadis_ProxyResolver($fetcher);
     list($canonicalID, $yadis_services) =
@@ -513,7 +513,7 @@ function Auth_OpenID_discoverXRI($iname, &$fetcher)
     return array($iname, $openid_services);
 }
 
-function Auth_OpenID_discover($uri, &$fetcher)
+function Auth_OpenID_discover($uri, $fetcher)
 {
     // If the fetcher (i.e., PHP) doesn't support SSL, we can't do
     // discovery on an HTTPS URL.
index 84e4065..d5abfd2 100644 (file)
@@ -1097,7 +1097,7 @@ class Auth_OpenID_CheckIDRequest extends Auth_OpenID_Request {
                                   in OpenID 1.x immediate mode.');
                 }
 
-                $setup_request =& new Auth_OpenID_CheckIDRequest(
+                $setup_request = new Auth_OpenID_CheckIDRequest(
                                                 $this->identity,
                                                 $this->return_to,
                                                 $this->trust_root,
@@ -1677,9 +1677,9 @@ class Auth_OpenID_Server {
     function Auth_OpenID_Server(&$store, $op_endpoint=null)
     {
         $this->store =& $store;
-        $this->signatory =& new Auth_OpenID_Signatory($this->store);
-        $this->encoder =& new Auth_OpenID_SigningEncoder($this->signatory);
-        $this->decoder =& new Auth_OpenID_Decoder($this);
+        $this->signatory = new Auth_OpenID_Signatory($this->store);
+        $this->encoder = new Auth_OpenID_SigningEncoder($this->signatory);
+        $this->decoder = new Auth_OpenID_Decoder($this);
         $this->op_endpoint = $op_endpoint;
         $this->negotiator =& Auth_OpenID_getDefaultNegotiator();
     }
@@ -1757,4 +1757,4 @@ class Auth_OpenID_Server {
     }
 }
 
-?>
+?>
\ No newline at end of file
index f14a794..1a0d4ff 100644 (file)
@@ -255,7 +255,7 @@ class Auth_Yadis_XRDS {
      * Instantiate a Auth_Yadis_XRDS object.  Requires an XPath
      * instance which has been used to parse a valid XRDS document.
      */
-    function Auth_Yadis_XRDS(&$xmlParser, &$xrdNodes)
+    function Auth_Yadis_XRDS($xmlParser, $xrdNodes)
     {
         $this->parser =& $xmlParser;
         $this->xrdNode = $xrdNodes[count($xrdNodes) - 1];
@@ -352,7 +352,7 @@ class Auth_Yadis_XRDS {
         $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode);
 
         foreach ($services as $node) {
-            $s =& new Auth_Yadis_Service();
+            $s = new Auth_Yadis_Service();
             $s->element = $node;
             $s->parser =& $this->parser;
 
@@ -428,7 +428,7 @@ class Auth_Yadis_XRDS {
                 $matches = 0;
 
                 foreach ($filters as $filter) {
-                    if (call_user_func_array($filter, array($service))) {
+                    if (call_user_func_array($filter, array(&$service))) {
                         $matches++;
 
                         if ($filter_mode == SERVICES_YADIS_MATCH_ANY) {
index 4e8e8d0..51968eb 100644 (file)
@@ -8,7 +8,7 @@ require_once 'Auth/Yadis/XRDS.php';
 require_once 'Auth/Yadis/XRI.php';
 
 class Auth_Yadis_ProxyResolver {
-    function Auth_Yadis_ProxyResolver(&$fetcher, $proxy_url = null)
+    function Auth_Yadis_ProxyResolver($fetcher, $proxy_url = null)
     {
         $this->fetcher =& $fetcher;
         $this->proxy_url = $proxy_url;
index d89f77c..3f56875 100644 (file)
@@ -317,7 +317,7 @@ class Auth_Yadis_Yadis {
      * Auth_Yadis_Yadis, depending on whether the discovery
      * succeeded.
      */
-    function discover($uri, &$fetcher,
+    function discover($uri, $fetcher,
                       $extra_ns_map = null, $timeout = 20)
     {
         $result = new Auth_Yadis_DiscoveryResult($uri);
index ba8ea9e..56adb13 100644 (file)
@@ -322,7 +322,8 @@ class tx_openid_sv1 extends t3lib_svbase {
                // TODO Change this to a TYPO3-specific database-based store in future.
                // File-based store is ineffective and insecure. After changing
                // get rid of the FileStore include in includePHPOpenIDLibrary()
-               $openIDStorePath = PATH_site . 'typo3temp/tx_openid';
+               $openIDStorePath = PATH_site . 'typo3temp' . PATH_SEPARATOR . 'tx_openid';
+
                // For now we just prevent any web access to these files
                if (!file_exists($openIDStorePath . '/.htaccess')) {
                        file_put_contents($openIDStorePath . '/.htaccess', 'deny from all');