Skip to content

0.4.9 fatal error 'ProcessBuilder not found' #142

Description

@AaronHolbrook

v0.4.8 still works fine, but upgrading to 0.4.9 and then running this exact code gives me a fatal error.

Here's how I'm using Zippy:

use Alchemy\Zippy\Zippy;
use function Zeek\PHP_Util\rrmdir;

/**
 * Load all the composer packages
 */
require_once __DIR__ . '/vendor/autoload.php';

function generate_zip_file() {

	$toolkit_filename = 'toolkit.zip';

	$vendor_dir = __DIR__ . '/vendor';

	// Creates an archive.zip that contains a directory "folder" that contains
	// files contained in "/path/to/directory" recursively
	$zippy = Zippy::load();

	// Make our tmp directory
	if ( ! file_exists( __DIR__ . '/tmp' ) ) {
		mkdir( __DIR__ . '/tmp' );
	}

	$paths = [
		'index',
		'buttons',
		'breadcrumbs',
	];

	foreach ( $paths as $path ) {
		generate_path_html( $path );
	}

	$archive = $zippy->create( $toolkit_filename, [
		'vendor'       => $vendor_dir,
		'index.html'   => __DIR__ . '/tmp/index.html',
		'buttons.html' => __DIR__ . '/tmp/buttons.html',
	], true );

	// Remove the tmp directory
	rrmdir( __DIR__ . '/tmp' );
}

function generate_path_html( $path = 'index' ) {
	ob_start();

	echo shell_exec( 'php index.php ' . $path );

	$path_html = ob_get_clean();

	file_put_contents( "tmp/{$path}.html", $path_html );
}

generate_zip_file();

die;

And here's the error:

PHP Fatal error:  Uncaught Error: Class 'Symfony\Component\Process\ProcessBuilder' not found in /dev/sites/example/htdocs/vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactory.php:69
Stack trace:
#0 /dev/sites/example/htdocs/vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipVersionProbe.php(70): Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactory->create()
#1 /dev/sites/example/htdocs/vendor/alchemy/zippy/src/Adapter/AbstractAdapter.php(146): Alchemy\Zippy\Adapter\VersionProbe\ZipVersionProbe->getStatus()
#2 /dev/sites/example/htdocs/vendor/alchemy/zippy/src/Zippy.php(156): Alchemy\Zippy\Adapter\AbstractAdapter->isSupported()
#3 /dev/sites/example/htdocs/vendor/alchemy/zippy/src/Zippy.php(67): Alchemy\Zippy\Zippy->getAdapterFor('zip')
#4 /dev/sites/example/htdocs/script.php(42): Alchemy\Zippy\Zippy->create('toolkit.zip', Array, true)
#5 /dev/sites/example/htdocs/script.php(58): ETT\g in /dev/sites/example/htdocs/vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactory.php on line 69

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions