4
Unfortunately the problem has been repeated ... the two errors (the same) have only moved to lines 127 and 128 ...
Quote:
Notice: Trying to get property 'tag_name' of non-object in file /modules/publisher/class/Common/VersionChecks.php line 127 Error: Error: Cannot use object of type stdClass as array in file /modules/publisher/class/Common/VersionChecks.php line 128
Here the mod.
(#100)
public static function checkVerModule($helper, $source = 'github', $default = 'master')
{
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
$update = '';
$repository = 'XoopsModules25x/' . $moduleDirName;
// $repository = 'XoopsModules25x/publisher'; //for testing only
$ret = '';
$infoReleasesUrl = "https://api.github.com/repos/$repository/releases";
if ('github' === $source) {
if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) {
curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisherrn"]);
$curlReturn = curl_exec($curlHandle);
if (false === $curlReturn) {
trigger_error(curl_error($curlHandle));
} elseif (false !== strpos($curlReturn, 'Not Found')) {
trigger_error('Repository Not Found: ' . $infoReleasesUrl);
} else {
$file = json_decode($curlReturn, false);
/* nuovo if */
if (json_last_error() !== JSON_ERROR_NONE) {
curl_close($curlHandle);
return [];
} /* fine nuovo if */
$latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default);
$latestVersion = $file[0]->tag_name;
$prerelease = $file[0]->prerelease;
(#129)