ramsey / php-library-starter-kit

:building_construction: A tool to quickly set up the base files of a PHP library project.
MIT License
243 stars 25 forks source link

Error with Windows and Symfony/Process 2.8.52 #37

Closed ncou closed 1 year ago

ncou commented 2 years ago

Hi,

Nice piece of code. I have the same error as described here (https://github.com/ramsey/php-library-starter-kit/issues/32). It's an array to string conversion error.

I use composer v2.2.3 and the symfony/process version bundled with is the version 2.8.52. In the log there and error line 263 (https://github.com/symfony/process/blob/v2.8.52/Process.php#L263). This happen only in windows OS.

After looking at your code there is an error here : https://github.com/ramsey/php-library-starter-kit/blob/449428b38f9fec175962ab8fafbbfc2ac105bb40/src/LibraryStarterKit/Setup.php#L135

You look if the first parameter in the constructor has a typehint as "array" and if it's not the case you convert the array to string. In the v2.8.52 of the Process class there is no typehint so the command is left as an array and you will have the error line 263 of the process.

You should check if there is a typehint as array for the first parameter you don't convert it as a string ELSE you convert it as string. Same logic as used here : https://github.com/ramsey/devtools-lib/blob/ea4205cc4fb3b68126977deff59742ede8105c90/src/Process/Process.php#L71

I hope i am clear enough.

Keep up the good work.

gam04 commented 2 years ago

Hi,

Nice piece of code. I have the same error as described here (#32). It's an array to string conversion error.

I use composer v2.2.3 and the symfony/process version bundled with is the version 2.8.52. In the log there and error line 263 (https://github.com/symfony/process/blob/v2.8.52/Process.php#L263). This happen only in windows OS.

After looking at your code there is an error here :

https://github.com/ramsey/php-library-starter-kit/blob/449428b38f9fec175962ab8fafbbfc2ac105bb40/src/LibraryStarterKit/Setup.php#L135

You look if the first parameter in the constructor has a typehint as "array" and if it's not the case you convert the array to string. In the v2.8.52 of the Process class there is no typehint so the command is left as an array and you will have the error line 263 of the process.

You should check if there is a typehint as array for the first parameter you don't convert it as a string ELSE you convert it as string. Same logic as used here : https://github.com/ramsey/devtools-lib/blob/ea4205cc4fb3b68126977deff59742ede8105c90/src/Process/Process.php#L71

I hope i am clear enough.

Keep up the good work.

Hi I have the same issue on Linux Mint and PHP 8.0 The kit works perfectly until the Fixing style issues process. I get this problem: image.

ncou commented 2 years ago

Hi, It's not really the same error, i think you have bump you Composer version to the v2.3-RC1 and there is a lot of breaking change in this version.

Can you confirm wich version of Composer you are using ? (type "Composer --version" to get this information).

ramsey commented 1 year ago

The latest version of the starter kit (3.5) raises the minimum version of Composer to 2.5, which fixes this issue.