php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59403 svn_info isn't working "offline"
Submitted: 2010-09-07 06:00 UTC Modified: 2010-09-07 07:01 UTC
From: tyra3l at gmail dot com Assigned:
Status: Closed Package: svn (PECL)
PHP Version: 5.2.13 OS: Debian Lenny
Private report: No CVE-ID: None
 [2010-09-07 06:00 UTC] tyra3l at gmail dot com
Description:
------------
One couldn't use the svn_info for a checkout without providing 
valid authentication data.
I don't see any reason, why would the user/pass required for a 
simple svn info.
the returned result doesn't provide any data which isn't 
available from the local svn files.

Reproduce code:
---------------
<?php
$result = svn_info('/var/www/some_checkout/', false);
print_r($result);


Expected result:
----------------
Array
(
    [0] => Array
        (
            [path] 
...

Actual result:
--------------
Warning: svn_info(): svn error(s) occured
170001 (Authorization failed) OPTIONS of '...': authorization 
failed (http://...) in test.php on line 2


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-07 06:42 UTC] alan at akbkhome dot com
Try this change, then
svn_info('/var/www/some_checkout/', false, -5);
--- svn.c	(revision 303132)
+++ svn.c	(working copy)
@@ -2002,7 +2002,9 @@
 	array_init(return_value);
 
 	revision.value.number = revnum;
-	revision.kind = php_svn_get_revision_kind(revision); 
+       revision.kind = !svn_path_is_url(path) && revnum < -4 ? 
+                svn_opt_revision_unspecified : php_svn_get_revision_kind(revision); 
+ 
 
 	peg_revision.kind = svn_path_is_url(path)? 
 		svn_opt_revision_head: svn_opt_revision_unspecified;
 [2010-09-07 06:47 UTC] tyra3l at gmail dot com
this seems a little bit hackish to me.
maybe a separate parameter or flag bitmask would be a better 
idea.
btw. what was the reason which required the authentication for 
svn_info in the first place?

Tyrael
 [2010-09-07 06:48 UTC] alan at akbkhome dot com
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 [2010-09-07 06:51 UTC] alan at akbkhome dot com
This is the notes from the C API. - basically the revision 
needs to be set as UNSPECIFIED for local info to work.

 * If both revision arguments are either @c
 * svn_opt_revision_unspecified or NULL, then information  
will be
 * pulled solely from the working copy; no network 
connections will be
 * made.

The php api now accepts this.

svn_info('/var/www/some_checkout/', false, 
SVN_REVISION_UNSPECIFIED);
 [2010-09-07 07:01 UTC] tyra3l at gmail dot com
the SVN_REVISION_UNSPECIFIED seems good, if I can use NULL 
for this behavior, thats even better, because this reflects 
the default behavior of the cli svn client ("svn info" 
without specified revision number works offline, with 
specified revision number, its not).

thanks for the fix.

Tyrael
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 04:03:40 2021 UTC