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

Warnings / broken autoloading with Strauss 0.18.0 vs 0.17.0 #101

Closed
leewillis77 opened this issue Apr 25, 2024 · 5 comments
Closed

Warnings / broken autoloading with Strauss 0.18.0 vs 0.17.0 #101

leewillis77 opened this issue Apr 25, 2024 · 5 comments

Comments

@leewillis77
Copy link

Version 0.18.0 contains a change which I believe is breaking strauss in my project:

Fix: composer dump-autoload error after delete-vendor-files/delete-vendor-packages

With strauss v0.17.0 the output of composer install [which triggers strauss] ends as follows and everything works as expected:

[info] Loading config...
[info] Building dependency list...
[info] Enumerating files...
[info] Copying files...
[info] Determining changes...
[info] Performing replacements...
[info] Adding licenses...
[info] Generating autoloader...
[info] Cleaning up...
> composer dump-autoload
Generating autoload files
Generated autoload files

The same configuration run against strauss v0.18.0 throws a bunch of warnings to the console and yields a broken project:

[info] Loading package...
[info] Loading composer.json config...
[info] Loading cli config...
[info] Building dependency list...
[info] Enumerating files...
[info] Copying files...
[info] Determining changes...
[info] Performing replacements...
[info] Adding licenses...
[info] Skipping autoloader generation as target directory is in Composer classmap. Run `composer dump-autoload`.
[info] Cleaning up...

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181

Notice: Undefined index: autoload in phar:///usr/local/bin/strauss/src/Cleanup.php on line 155

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/strauss/src/Cleanup.php on line 156

Warning: array_filter() expects parameter 1 to be array, null given in phar:///usr/local/bin/strauss/src/Cleanup.php on line 181
> composer dump-autoload
Generating autoload files
Generated autoload files

After the install is run, autoloading appears broken for some items, e.g. Fatal error: Uncaught Error: Class 'Composer\XdebugHandler\XdebugHandler' not found

To reproduce the issue, follow the process below which strauss invoking either v0.17.0 or v0.18.0. Everything works as expected under v0.17.0, but fails under v0.18.0:

$ git clone git@github.com:leewillis77/strauss-issue.git
$ cd strauss-issue
$ composer install
$ php test.php                              // Will work as expected
$ composer run phpmd               // Will work as expected

Everything looks good at this point.

$ composer update

At this point strauss v0.18.0 will throw a bunch of PHP warnings and notices to the console, and autoloading will be broken.

$ php test.php // Still works
$ composer run phpmd            // Does not work under strauss v0.18.0, and throws a Class not found error, despite the class being present under the vendor/ folder

Oddly, in my build pipeline, everything fails after the initial install, but I couldn't reproduce that on my local machine, and a composer install then composer update is required before things break. Probably just a difference in my actual repo vs the example one I put together, but not quite sure what that might be.

@JUVOJustin
Copy link

Can confirm. Also happening in my github ci setups

@BrianHenryIE
Copy link
Owner

BrianHenryIE commented Apr 26, 2024

Oops. Should be fixed now. 7a0a927

@leewillis77
Copy link
Author

Thanks for the reply here. While v0.19.0 now no longer throws warnings to the console, autoloading is still broken with v0.19.0 versus v0.17.0 - ie this step in the reproduction:

$ php test.php // Still works
$ composer run phpmd            // Does not work under strauss v0.19.0, and throws a Class not found error, despite the class being present under the vendor/ folder

@BrianHenryIE BrianHenryIE reopened this Apr 26, 2024
@BrianHenryIE
Copy link
Owner

BrianHenryIE commented Apr 26, 2024

I seem to have that fixed now. I was missing / in a path.

07c4945

@leewillis77
Copy link
Author

Confirming that v0.19.1 resolves the issues we were having - thanks!

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

3 participants