XF 2.1 Can't remove an add-on: [E_WARNING] file_get_contents()

Recep Baltaş

Well-known member
What am I missing?


Code:
ErrorException: [E_WARNING] file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in src/addons/VNNET/UpThread/Setup.php at line 42
XF::handlePhpError()
file_get_contents() in src/addons/VNNET/UpThread/Setup.php at line 42
VNNET\UpThread\Setup->uninstall() in src/XF/Admin/Controller/AddOn.php at line 635
XF\Admin\Controller\AddOn->actionUninstall() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
XF\App->run() in src/XF.php at line 390
XF::runApp() in admin.php at line 13
 
Solved:
  1. Login to your Cpanel
  2. Under Software click on MultiPHP INI Editor
  3. Click on Editor Mode and select Domain
  4. Paste allow_url_fopen = 1 and save
 
Last edited:
I would be a little bit concerned that an add-on is opening a request to a remote website on uninstall.

Could you post the contents of src/addons/VNNET/UpThread/Setup.php at line 42 with a few surrounding lines so we could inspect it?
 
  • Like
Reactions: HWS
Yeah, it was controversial when the dev put a licencse check in the add-on... Funny that he took the money and left, LOL :D

PHP:
<?php

namespace VNNET\UpThread;

use XF\Db\Schema\Alter;
use XF\Db\Schema\Create;

class Setup extends \XF\AddOn\AbstractSetup
{
    use \XF\AddOn\StepRunnerInstallTrait;
    use \XF\AddOn\StepRunnerUpgradeTrait;
    use \XF\AddOn\StepRunnerUninstallTrait;

    public function installStep1()
    {
        $server = $_SERVER['SERVER_NAME'];
        $addId = 21;
        $file = file_get_contents('https://vnnet.org/lic/'.$server.'/'.$addId);
        $exp = explode('|', $file);
        if($exp[0] != 1){
            exit('This domain '.$server.' not license in VNNET, please contact admin@vnnet.org');
        }
        $tableName = $exp[1];
        $this->schemaManager()->createTable($tableName, function(Create $table)
        {
            $table->addColumn('id', 'int')->autoIncrement(true);
            $table->addColumn('thread_id', 'int');
            $table->addColumn('user_id', 'int');
            $table->addColumn('date', 'int');
            $table->addPrimaryKey('id');
        });
    }

    public function upgrade(array $stepParams = [])
    {
    }

    public function uninstall(array $stepParams = [])
    {
        $server = $_SERVER['SERVER_NAME'];
        $addId = 21;
        $file = file_get_contents('https://vnnet.org/lic/'.$server.'/'.$addId);
        $exp = explode('|', $file);
        if($exp[0] != 1){
            exit('This domain '.$server.' not license in VNNET, please contact admin@vnnet.org');
        }
        $tableName = $exp[1];
        $this->schemaManager()->dropTable($tableName);
    }
}
 
Yeah, it would appear as if this addon violates the resource standards:
26. Add-ons must only use any sort of license callback if that is made clear in the resource description; usual guidelines regarding this apply.
(At the time of writing, there is no such information in the resource description.)

It would also appear to violate the resource guidelines (Add-Ons section):
3. Uninstallation must not depend on an external server. If an external request needs to occur during uninstallation and this request fails, uninstallation should still be able to proceed. You must not block or prevent uninstallation in any way.

I'll leave it up to you whether you wish to report this add-on to the staff, as I'm not a customer of theirs. It's not my place to be the police in this case, these are my observations based on the information in this thread and the resource description.
 
Top Bottom