changed to check the resturn value of svn_info() against NULL additionally

This commit is contained in:
hyung-hwan 2019-08-29 15:44:45 +00:00
parent ab5dcb43f7
commit 3b7932c6f6

View File

@ -34,7 +34,7 @@ class SubversionModel extends CodeRepoModel
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
// If a URL is at the root of repository and the url type is file://
// (e.g. file:///svnrepo/codepot/ where /svnrepo/codepot is a project root),
@ -52,7 +52,7 @@ class SubversionModel extends CodeRepoModel
// rebuild the URL with a peg revision and retry it.
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
$info0 = &$info[0];
@ -199,12 +199,12 @@ class SubversionModel extends CodeRepoModel
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
if ($rev == SVN_REVISION_HEAD || $path == '') return FALSE;
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
$info0 = $info[0];
@ -262,7 +262,7 @@ class SubversionModel extends CodeRepoModel
if ($rev == SVN_REVISION_HEAD)
{
$info = @svn_info($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALASE;
}
else
{
@ -274,14 +274,14 @@ class SubversionModel extends CodeRepoModel
// regardless of the given revision.
//
$info = @svn_info($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
//
// Try further with the original revision
//
$rev = $orgrev;
$info = @svn_info ($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
//
// don't try with a pegged url for a project root
@ -293,7 +293,7 @@ class SubversionModel extends CodeRepoModel
//
$url = $url . '@' . $rev;
$info = @svn_info($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
}
}
@ -659,10 +659,10 @@ class SubversionModel extends CodeRepoModel
*/
if ($rev != SVN_REVISION_HEAD && $path != '') $url = $url . '@' . $rev;
$info = @svn_info($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
$info = @svn_info($orgurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
$url = $orgurl;
}
@ -1091,10 +1091,10 @@ class SubversionModel extends CodeRepoModel
// the actual URLs may be different from $url
// if the file has been changed.
$info1 = @svn_info($workurl1, FALSE, $rev1);
if ($info1 === FALSE || count($info1) != 1) return FALSE;
if ($info1 === FALSE || $info1 === NULL || count($info1) != 1) return FALSE;
if ($info1[0]['kind'] != SVN_NODE_FILE) return FALSE;
$info2 = @svn_info($workurl2, FALSE, $rev2);
if ($info2 === FALSE || count($info1) != 1) return FALSE;
if ($info2 === FALSE || $info2 === NULL || count($info2) != 1) return FALSE;
if ($info2[0]['kind'] != SVN_NODE_FILE) return FALSE;
// get the difference with the actual URLs
@ -1171,12 +1171,12 @@ class SubversionModel extends CodeRepoModel
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
if ($rev == SVN_REVISION_HEAD || $path == '') return $rev;
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return $rev;
if ($info === FALSE || $info === NULL || count($info) != 1) return $rev;
}
$log = @svn_log (
@ -1253,7 +1253,7 @@ class SubversionModel extends CodeRepoModel
for ($count = $count - 2; $count >= 0; $count--)
{
$info = @svn_info($url, FALSE, $log[$count]['rev']);
if ($info === FALSE) return FALSE;
if ($info === FALSE || $info === NULL) return FALSE;
if ($info[0]['last_changed_rev'] > $rev)
{
@ -1275,24 +1275,24 @@ class SubversionModel extends CodeRepoModel
$workrev = $rev;
$info = @svn_info($workurl, FALSE, $workrev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
else
{
$workurl = "{$orgurl}@";
$workrev = SVN_REVISION_HEAD;
$info = @svn_info($workurl, FALSE, $workrev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
$workrev = $rev;
$info = @svn_info($workurl, FALSE, $workrev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
if ($rev == SVN_REVISION_HEAD) return FALSE;
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info($workurl, FALSE, $workrev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
}
}
@ -1359,7 +1359,7 @@ class SubversionModel extends CodeRepoModel
set_error_handler (array ($this, 'capture_error'));
$info = @svn_info($url, FALSE);
restore_error_handler ();
if ($info == FALSE || count($info) != 1) return FALSE;
if ($info == FALSE || $info === NULL || count($info) != 1) return FALSE;
$props = array ();
$xi = $info[0];
@ -1385,7 +1385,7 @@ class SubversionModel extends CodeRepoModel
set_error_handler (array ($this, 'capture_error'));
$info = @svn_info($url, FALSE);
restore_error_handler ();
if ($info == FALSE || count($info) != 1) return FALSE;
if ($info == FALSE || $info === NULL || count($info) != 1) return FALSE;
$xi = $info[0];
for ($rev = $xi['revision']; $rev > 0; $rev--)
@ -1413,7 +1413,7 @@ class SubversionModel extends CodeRepoModel
$info = @svn_info($workurl, FALSE, $rev);
restore_error_handler ();
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
if ($rev == SVN_REVISION_HEAD || $path == '') return FALSE;
@ -1422,7 +1422,7 @@ class SubversionModel extends CodeRepoModel
set_error_handler (array ($this, 'capture_error'));
$info = @svn_info($workurl, FALSE, $rev);
restore_error_handler ();
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
set_error_handler (array ($this, 'capture_error'));
@ -1441,7 +1441,7 @@ class SubversionModel extends CodeRepoModel
$info = @svn_info($workurl, FALSE, $rev);
restore_error_handler ();
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
if ($rev == SVN_REVISION_HEAD || $path == '') return FALSE;
@ -1450,7 +1450,7 @@ class SubversionModel extends CodeRepoModel
set_error_handler (array ($this, 'capture_error'));
$info = @svn_info($workurl, FALSE, $rev);
restore_error_handler ();
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
set_error_handler (array ($this, 'capture_error'));
@ -1465,7 +1465,7 @@ class SubversionModel extends CodeRepoModel
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
// If a URL is at the root of repository and the url type is file://
// (e.g. file:///svnrepo/codepot/ where /svnrepo/codepot is a project root),
@ -1483,7 +1483,7 @@ class SubversionModel extends CodeRepoModel
// rebuild the URL with a peg revision and retry it.
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
if ($info[0]['kind'] == SVN_NODE_FILE) return FALSE;
@ -1562,7 +1562,7 @@ class SubversionModel extends CodeRepoModel
$trailer = ($current_path == '')? '': '@'; // trailing @ for collision prevention
$workurl = $orgurl . $trailer;
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
// If a URL is at the root of repository and the url type is file://
// (e.g. file:///svnrepo/codepot/ where /svnrepo/codepot is a project root),
@ -1581,7 +1581,7 @@ class SubversionModel extends CodeRepoModel
$trailer = "@{$rev}";
$workurl = $orgurl . $trailer;
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) continue;
if ($info === FALSE || $info === NULL || count($info) != 1) continue;
}
if ($info[0]['kind'] == SVN_NODE_FILE) return FALSE;
@ -2151,7 +2151,7 @@ class SubversionModel extends CodeRepoModel
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
if ($info === FALSE || $info === NULL || count($info) != 1)
{
// If a URL is at the root of repository and the url type is file://
// (e.g. file:///svnrepo/codepot/ where /svnrepo/codepot is a project root),
@ -2169,7 +2169,7 @@ class SubversionModel extends CodeRepoModel
// rebuild the URL with a peg revision and retry it.
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
if ($info === FALSE || $info === NULL || count($info) != 1) return FALSE;
}
// pass __FILE__ as the first argument so that tempnam creates a name