List Info

Thread: Fix for "Problem with authentication per repository"




Fix for "Problem with authentication per repository"
user name
2006-03-07 06:02:58

Hi Tim & list

We have started using WebSVN (lastest trunk 444) at out company.  We ran into the same problem as detailed in the thread with subject "Problem with authentication per repository" http://websvn.tigris.org/servlets/ReadMsg?list=dev&msgNo=972

The problem turns out to be a reference issue as mooted in http://websvn.tigris.org/servlets/ReadMsg?list=dev&;msgNo=968

We are running PHP 4.3.9 on CentOS/RHEL 4.2.  The issue is with the findRepository method in ./include/configclass.inc returning a *reference to a copy* instead of a *reference to the original*.  This is because the foreach construct in the function makes a *copy* of the array being iterated over (see the second note on the page at http://www.php.net/manual/en/control-structures.foreach.php).

The fix me me was the following:

--- configclass.inc.orig        2006-03-03 10:39:17.000000000 +0200
+++ configclass.inc        2006-03-03 15:10:56.000000000 +0200
-498,12 +498,13
 
    function &findRepository($name)
    {
       foreach ($this->_repositories as $index => $rep)
       {
+         $repref =& $this->_repositories[$index];
          if (strcmp($rep->getDisplayName(), $name) == 0)
-            return $rep;
+            return $repref;
       }
       
       print "ERROR: Unable to find repository '$name'";
       exit;
    }



This is not the most elegant, but it works.  For php 5 this is not necessary as you can reference the array in the foreach, however, this doesn't help us php 4'ers though...

Regards
-ant

***************
Any views expressed in this message are those of the individual sender, and Sanlam accepts no liability for such views, except where the sender specifically states them to be those of Sanlam.
Sanlam Life Insurance Limited is a Licensed Financial Services Provider.
Enige sienswyses of stellings wat in hierdie boodskap uitgedruk word is dié van die individuele afsender, en Sanlam aanvaar geen aanspreeklikheid daarvoor nie, behalwe waar die afsender uitdruklik vermeld dat dit dié van Sanlam is.
Sanlam Lewensversekering Beperk is ‘n Gelisensieerde Verskaffer van Finansiėle Dienste.
Fix for "Problem with authentication per repository"
user name
2006-03-09 06:02:45
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anthony.CaetanoSanlam.co.za wrote:
> Hi Tim & list
> 
> We have started using WebSVN (lastest trunk 444) at out
company.  We ran 
> into the same problem as detailed in the thread with
subject "Problem with 
> authentication per repository" 
> http://websvn.tigris.org/servlets/ReadMsg?list=d
ev&msgNo=972
> 
> The problem turns out to be a reference issue as mooted
in 
> http://websvn.tigris.org/servlets/ReadMsg?list=d
ev&msgNo=968
> 
> We are running PHP 4.3.9 on CentOS/RHEL 4.2.  The issue
is with the 
> findRepository method in ./include/configclass.inc
returning a *reference 
> to a copy* instead of a *reference to the original*. 
This is because the 
> foreach construct in the function makes a *copy* of the
array being 
> iterated over (see the second note on the page at 
> http://www.php.net/manual/en/control-structures.forea
ch.php).
> 
> The fix me me was the following:
> 
> --- configclass.inc.orig        2006-03-03
10:39:17.000000000 +0200
> +++ configclass.inc     2006-03-03 15:10:56.000000000
+0200
>  -498,12 +498,13 
>  
>     function &findRepository($name)
>     {
>        foreach ($this->_repositories as $index =>
$rep)
>        {
> +         $repref =&
$this->_repositories[$index];
>           if (strcmp($rep->getDisplayName(), $name)
== 0)
> -            return $rep;
> +            return $repref;
>        }
>  
>        print "ERROR: Unable to find repository
'$name'";
>        exit;
>     }
> 
> 
> 
> This is not the most elegant, but it works.  For php 5
this is not 
> necessary as you can reference the array in the
foreach, however, this 
> doesn't help us php 4'ers though...
> 
> Regards
> -ant
>  
> *************** 
> Any views expressed in this message are those of the
individual sender, 
> and Sanlam accepts no liability for such views, except
where the sender 
> specifically states them to be those of Sanlam.
> Sanlam Life Insurance Limited is a Licensed Financial
Services Provider.
> Enige sienswyses of stellings wat in hierdie boodskap
uitgedruk word is 
> diƩ van die individuele afsender, en Sanlam aanvaar
geen aanspreeklikheid 
> daarvoor nie, behalwe waar die afsender uitdruklik
vermeld dat dit diƩ van 
> Sanlam is.
> Sanlam Lewensversekering Beperk is ?n Gelisensieerde
Verskaffer van 
> Finansiƫle Dienste.
Aiee, again with the PHP 4 crap! :P

If you find any other return by reference problems, let us
know.

- --
Matt 'Junx' Sicker
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFED8UF5tcAKF5t41MRAv1zAJ9T0H7HmWdn3SBA2lc9/7+sITqVFACg
ihV7
iV8l5kbujg2Y9Agf9oZz8Tc=
=G2jJ
-----END PGP SIGNATURE-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribewebsvn.tigris.org
For additional commands, e-mail: dev-helpwebsvn.tigris.org

Fix for "Problem with authentication per repository"
user name
2006-04-14 15:48:35
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anthony.CaetanoSanlam.co.za wrote:
> Hi Tim & list
> 
> We have started using WebSVN (lastest trunk 444) at out
company.  We ran 
> into the same problem as detailed in the thread with
subject "Problem with 
> authentication per repository" 
> http://websvn.tigris.org/servlets/ReadMsg?list=d
ev&msgNo=972
> 
> The problem turns out to be a reference issue as mooted
in 
> http://websvn.tigris.org/servlets/ReadMsg?list=d
ev&msgNo=968
> 
> We are running PHP 4.3.9 on CentOS/RHEL 4.2.  The issue
is with the 
> findRepository method in ./include/configclass.inc
returning a *reference 
> to a copy* instead of a *reference to the original*. 
This is because the 
> foreach construct in the function makes a *copy* of the
array being 
> iterated over (see the second note on the page at 
> http://www.php.net/manual/en/control-structures.forea
ch.php).
> 
> The fix me me was the following:
> 
> --- configclass.inc.orig        2006-03-03
10:39:17.000000000 +0200
> +++ configclass.inc     2006-03-03 15:10:56.000000000
+0200
>  -498,12 +498,13 
>  
>     function &findRepository($name)
>     {
>        foreach ($this->_repositories as $index =>
$rep)
>        {
> +         $repref =&
$this->_repositories[$index];
>           if (strcmp($rep->getDisplayName(), $name)
== 0)
> -            return $rep;
> +            return $repref;
>        }
>  
>        print "ERROR: Unable to find repository
'$name'";
>        exit;
>     }
> 
> 
> 
> This is not the most elegant, but it works.  For php 5
this is not 
> necessary as you can reference the array in the
foreach, however, this 
> doesn't help us php 4'ers though...
> 
> Regards
> -ant
>  
> *************** 
> Any views expressed in this message are those of the
individual sender, 
> and Sanlam accepts no liability for such views, except
where the sender 
> specifically states them to be those of Sanlam.
> Sanlam Life Insurance Limited is a Licensed Financial
Services Provider.
> Enige sienswyses of stellings wat in hierdie boodskap
uitgedruk word is 
> diƩ van die individuele afsender, en Sanlam aanvaar
geen aanspreeklikheid 
> daarvoor nie, behalwe waar die afsender uitdruklik
vermeld dat dit diƩ van 
> Sanlam is.
> Sanlam Lewensversekering Beperk is ?n Gelisensieerde
Verskaffer van 
> Finansiƫle Dienste.
Actually, fixed in revision 448.  Thanks for the patch.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEP8RT5tcAKF5t41MRAtu6AJ9eLgm7VBcr7rhLfKSLmKz2k3Zg8QCd
GJa3
lFXfeSYw5L88cjQ1L8WXo6c=
=RHgx
-----END PGP SIGNATURE-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribewebsvn.tigris.org
For additional commands, e-mail: dev-helpwebsvn.tigris.org

Fix for "Problem with authentication per repository"
user name
2006-04-19 09:15:15

Hi Matt
My pleasure, thanks for applying it.
-ant

Matt Sicker <boardsgmail.com&gt; wrote on 2006/04/14 05:48:35 PM:

>; Actually, fixed in revision 448.  Thanks for the patch.


Disclaimer
Sanlam Life Insurance Limited Reg no 1998/021121/06
Licensed Financial Service Provider

Disclaimer and Directors
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )