{"id":16934694,"date":"2023-07-31T08:55:06","date_gmt":"2023-07-31T08:55:06","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/issue-on-http\/"},"modified":"2023-07-31T08:55:06","modified_gmt":"2023-07-31T08:55:06","slug":"issue-on-http","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/issue-on-http\/","title":{"rendered":"Issue on HTTP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello we have a big issue when we work offline or on HTTP<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The main problem is that your plugin always checks the last version of siteorigin-installer (which is not great)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and the request always offline or HTTP returns error<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And because is an error the value instead of ARRAY is FALSE. But your code expects an array. The solution is straightforward<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In siteorign-panels and so-widgets-bundle in file github-plugin-updater.php<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">in this code<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">public function check_for_update( $transient ) {<br \/>$all_headers = $this-&gt;get_plugin_headers();<br \/>$plugin_path = $this-&gt;get_plugin_path();<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">if ( version_compare( <em>SITEORIGIN_INSTALLER_VERSION<\/em>, $all_headers[&#8216;Version&#8217;], &#8216;&lt;&#8216; ) ) {<br \/>\/\/ There is a newer version available on Github<br \/>$update = new stdClass();<br \/>$update-&gt;slug = $plugin_path;<br \/>$update-&gt;new_version = $all_headers[&#8216;Version&#8217;];<br \/>$update-&gt;url = $all_headers[&#8216;PluginURI&#8217;];<br \/>$update-&gt;package = &#8216;https:\/\/github.com\/siteorigin\/siteorigin-installer\/archive\/&#8217; . self::<em>UPDATES_BRANCH <\/em>. &#8216;.zip&#8217;;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$transient-&gt;response[ $plugin_path ] = $update;<br \/>}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">return $transient;<br \/>}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>add verification that $all_headers are not false<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">public function check_for_update( $transient ) {<br \/>$all_headers = $this-&gt;get_plugin_headers();<br \/>$plugin_path = $this-&gt;get_plugin_path();<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">if ( $all_headers &amp;&amp; version_compare( <em>SITEORIGIN_INSTALLER_VERSION<\/em>, $all_headers[&#8216;Version&#8217;], &#8216;&lt;&#8216; ) ) {<br \/>\/\/ There is a newer version available on Github<br \/>$update = new stdClass();<br \/>$update-&gt;slug = $plugin_path;<br \/>$update-&gt;new_version = $all_headers[&#8216;Version&#8217;];<br \/>$update-&gt;url = $all_headers[&#8216;PluginURI&#8217;];<br \/>$update-&gt;package = &#8216;https:\/\/github.com\/siteorigin\/siteorigin-installer\/archive\/&#8217; . self::<em>UPDATES_BRANCH <\/em>. &#8216;.zip&#8217;;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$transient-&gt;response[ $plugin_path ] = $update;<br \/>}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">return $transient;<br \/>}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>OR verify that $all_headers[&#8216;Version&#8217;]<\/strong> <strong>is set<\/strong> because if is not set there is an error notice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you<\/p>\n","protected":false},"template":"","class_list":["post-16934694","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16934694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16934694\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16934694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}