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

Undefined variable $pipes #1

Open
rognoni opened this issue Jul 21, 2023 · 0 comments
Open

Undefined variable $pipes #1

rognoni opened this issue Jul 21, 2023 · 0 comments

Comments

@rognoni
Copy link
Owner

rognoni commented Jul 21, 2023

When you execute Artisan::call('migrate') from web, on AlterVista (shared hosting)

Route::get('/CatLink/artisan/migrate', function () {
    Artisan::call('migrate');
    return Artisan::output();
});

because the PHP 8.2 function proc_open exists and returns false (was all ok with PHP 7.3)

PHP 7.3 function_exists('proc_open') --> FALSE
PHP 8.2 function_exists('proc_open') --> TRUE

but this is a problem here:

// vendor/symfony/console/Terminal.php:220
private static function readFromProcess(string|array $command): ?string
{
    if (!\function_exists('proc_open')) {
        return null;
    }

    $descriptorspec = [
        1 => ['pipe', 'w'],
        2 => ['pipe', 'w'],
    ];

    $cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;

    $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
    if (!\is_resource($process)) {
        return null;
    }

    $info = stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    fclose($pipes[2]);
    proc_close($process);

    if ($cp) {
        sapi_windows_cp_set($cp);
    }

    return $info;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant