Skip to content

Undefined variable $pipes #1

@rognoni

Description

@rognoni

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions