Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.5][Warning] Expected type 'string'. Found 'resource'." #547

Closed
jonamix-ar opened this issue May 1, 2023 · 0 comments
Closed

[3.5][Warning] Expected type 'string'. Found 'resource'." #547

jonamix-ar opened this issue May 1, 2023 · 0 comments
Assignees
Labels
Bug Issues that is an error, bug or it is not working as expected Fixed Issues that after being labeled as Bug have been resolved
Milestone

Comments

@jonamix-ar
Copy link

Bien este error me lo viene tirando Visual Code como warning "Expected type 'string'. Found 'resource'."

 // check if something was created and delete it
if (file_exists($config_file)) {
    unlink($config_file);
}

Cambie todo el codigo por este y no tira mas el error verifique la instalación y funciono

$config_file = fopen(XGP_ROOT . CONFIGS_PATH . 'config.php', 'w');

if (!$config_file) {
    return false;
}

$data = "<?php\n";
$data .= "defined('DB_HOST') ? null : define('DB_HOST', '" . $this->db_host . "');\n";
$data .= "defined('DB_USER') ? null : define('DB_USER', '" . $this->db_user . "');\n";
$data .= "defined('DB_PASS') ? null : define('DB_PASS', '" . $this->db_password . "');\n";
$data .= "defined('DB_NAME') ? null : define('DB_NAME', '" . $this->db_name . "');\n";
$data .= "defined('DB_PREFIX') ? null : define('DB_PREFIX', '" . $this->db_prefix . "');\n";
$data .= "defined('SECRETWORD') ? null : define('SECRETWORD', 'xgp-"  . StringsHelper::randomString(16) . "');\n";
$data .= '?>';

// create the new file
if (fwrite($config_file, $data)) {
    fclose($config_file);

    return true;
}

// check if something was created and delete it
if (file_exists(XGP_ROOT . CONFIGS_PATH . 'config.php')) {
    unlink(XGP_ROOT . CONFIGS_PATH . 'config.php');
}

return false;
@LucasKovacs LucasKovacs self-assigned this May 1, 2023
@LucasKovacs LucasKovacs added the Bug Issues that is an error, bug or it is not working as expected label May 1, 2023
@LucasKovacs LucasKovacs added this to the v3.5.0 milestone May 1, 2023
LucasKovacs added a commit that referenced this issue May 1, 2023
@LucasKovacs LucasKovacs added the Fixed Issues that after being labeled as Bug have been resolved label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that is an error, bug or it is not working as expected Fixed Issues that after being labeled as Bug have been resolved
Projects
Status: Done
Development

No branches or pull requests

2 participants