Closed astorm closed 4 years ago
In the README.md
Troubleshooting Upgrades
If you've upgraded pestle and you're seeing the following exception
PHP Fatal error: Cannot redeclare Pulsestorm\Magento2\Cli\Help\pestle_cli() Try removing the following temp folder.
/tmp/pestle_cache We know this isn't ideal, and we're working on a more permanat fix.
@ZiruZanrgeiff Thank you for contributing, but I'm not sure I follow what you're trying to say?
Oh forgive me, I made a mistake.
No worries @ZiruZanrgeiff -- I'm going to close this, but if there's anything we can do to help please let us know.
@astorm This is still an issue.
@theycallmepepper Thanks for the heads up? Did deleting the /tmp/pestle_cache
restore functionality? Or are you still stuck?
Also, if you have a moment, a few questions to help narrow cause possible causes.
Do you have a record of the exact command invocation that cause the problem?
Did this happen after an upgrade, or just randomly? If after an upgrade, was it a self downloaded upgrade or one using selfupdate?
@astorm No worries, clearing /tmp/pestle_cache
( or in the case of Windows the tmp dir set in php.ini ) got things up and running again.
Honestly, the way I end up reproducing this issue is by using the phar directly in a project root instead of adding it to PATH
and then moving on to a different project and doing the same thing.
I noticed it first after using it on a Windows dev box and then started tinkering with this at home on OSX.
@theycallmepepper Re:
Honestly, the way I end up reproducing this issue is by using the phar directly in a project root instead of adding it to PATH and then moving on to a different project and doing the same thing.
Thank you! Those are the first clear reproduction steps we've had on this and we should be able to use them to get a fix in place. Memorializing the steps here for when I, or someone else, comes back to this.
pestle.phar
to ~/bin
pestle.phar help
pestle.phar
to folder that is not ~/bin
php pestle.phar
syntaxExpected Behavior: Everything is fine.
Actual Behavior: Explodes with stack trace
$ php pestle.phar
PHP Fatal error: Cannot redeclare Pulsestorm\Magento2\Cli\Help\pestle_cli() (previously declared in phar:///Users/alanstorm/Documents/github_private/GeneralCode/bin/pestle.phar/modules/pulsestorm/magento2/cli/help/module.php:9) in phar:///Users/alanstorm/Sites/magento-2-1-3.dev/project-community-edition/pestle.phar/modules/pulsestorm/magento2/cli/help/module.php on line 17
PHP Stack trace:
PHP 1. {main}() /Users/alanstorm/Sites/magento-2-1-3.dev/project-community-edition/pestle.phar:0
PHP 2. main() /Users/alanstorm/Sites/magento-2-1-3.dev/project-community-edition/pestle.phar:9
PHP 3. Pulsestorm\Pestle\Runner\main() /Users/alanstorm/Sites/magento-2-1-3.dev/project-community-edition/pestle.phar:7
PHP 4. ReflectionFunction->invokeArgs() phar:///Users/alanstorm/Sites/magento-2-1-3.dev/project-community-edition/pestle.phar/modules/pulsestorm/pestle/runner/module.php:391
PHP 5. Pulsestorm\Magento2\Cli\Help\pestle_cli() phar:///Users/alanstorm/Sites/magento-2-1-3.dev/project-community-edition/pestle.phar/modules/pulsestorm/pestle/runner/module.php:391
PHP 6. Pulsestorm\Magento2\Cli\List_Commands\pestle_cli() phar:///Users/alanstorm/Documents/github_private/GeneralCode/bin/pestle.phar/modules/pulsestorm/magento2/cli/help/module.php:16
PHP 7. includeAllModuleFiles() phar:///Users/alanstorm/Documents/github_private/GeneralCode/bin/pestle.phar/modules/pulsestorm/magento2/cli/list_commands/module.php:18
PHP 8. ReflectionFunction->invokeArgs() /private/tmp/pestle_cache/2d27f575ea4837c003f8467c72c32131/reflection-strategy/5b6a58ff79aaa3de996e23fb907561e6.php:7
PHP 9. Pulsestorm\Cli\Build_Command_List\includeAllModuleFiles() /private/tmp/pestle_cache/2d27f575ea4837c003f8467c72c32131/reflection-strategy/5b6a58ff79aaa3de996e23fb907561e6.php:7
I'm on Windows 10 and I had this issue as well I have no idea where /tmp files is used
I tried
%tmp% : didn't find any pestle_cache my php.ini that php-cli depends on in c:/wamp/tmp : didn't find any pestle_cache
I ran directly in the my magento project root.
Fatal error: Cannot redeclare Pulsestorm\Pestle\Library\exitWithErrorMessage() (previously declared in phar://C:/Users/{computername}/AppData/Local/Temp/pestle.phar/library/all.php:12772) in phar://C:/Users/{computername}/AppData/Local/Temp/pestle.phar/modules/pulsestorm/pestle/library/module.php on line 11
Please help
Found the /tmp/ folder location in Windows 10,
Its in C:/tmp/pestle_cache
but deleting/rename it doesn't help, I still have the redeclare fatal error.
Here's the content in case you wanna debug. 2d27f575ea4837c003f8467c72c32131.zip
Okay, finally I get it working after 4 hours waste on it, I suppose to working on learning Knockout UI; but all my energy has wasted just to get things working. Is there any way install /vendor directly? I think it would be better, as pestle.phar files are not stable. Composer.phar did a good job, though.
Anyhow, for Windows 10 users, look at these places to delete the pestle_cache folder
For my case, I found it in my Windows directory which is C:/tmp/pestle
It'll take some time that appears as "lag", once done, finger-crossed that pestle command comes up and your C:/tmp/ should repopulate with pestle_cache folder again.
P/S: I noticed that @astorm uses "php://temp" in the extracted pestle.phar, it suppose to run in memory but somehow got "stucked". I figured that this might be the source of cannot redeclare error, but I run of ideas on how to test that. CMIIW.
@myself379 Sorry you run into an issue or three -- we're MacOS and Linux users around these parts and don't have a ton of experience running modern PHP on windows. We've opened an issue to offer official pestle support on windows: https://github.com/astorm/pestle/issues/352
Totally optional, but if you have a moment could you let us know
How you installed PHP on windows? (What Native windows installer, or Cygwin?, or Linux for Windows subsystem?)
What you mean when you say "install /vendor directly" -- it's not clear from context what you mean there.
My apologies to you as well @astorm, I must thank you for your work on pestle.phar
I'm using WAMP installer 3.0.6, it comes with PHP 5.6 only, but I added PHP 7.0.10 and PHP 7.2.2. I think that's not critical, as I configure my "Environmental Path" in Windows 10 to points to PHP 7.0.10, so the command "which php" for my cmd/cmder/bash/gitbash will point to PHP 7.0.10
It just that Windows might treat differently for running a script directly, like "./pestle.phar", it means directly run the current directory for file "pestle.phar", if I use "php pestle.phar" or "php -f pestle.phar" it runs normally and created a pestle_cache in "C:/tmp/pestle_cache"
Install directly in /vendor like example: "composer require astorm/pestle", then put a file in the root directory and runs like, like how "php artisan" works for Laravel. Anyhow, I think it'll give a future headache on maintaining two different types of methods to invoke pestle, i.e: one through pestle.phar and another through install via composer.json
@astorm side question, I'm currently working on modifying the Magento 2 stock module-checkout for the UI, my implementation needs to involve having external Javascript loaded from external AWS S3.
Not only that, I need to modify the UI component by adding additional shipping method that able to show the former custom widget that was loaded.
The challenge is to subscribe to observable to 'checked': element.isSelected
in Magento_Checkout/shipping-address/shipping-method-item
I then need to update the ViewModel of the shipping address selected based on the custom widget.
Upon checkout, I need to pass this ViewModel data on Shipping Method into Magento 2 order table.
It seems simple but I currently stuck on UI componenet, should I replace the whole custom UI or I can inject them via XML? Where can I properly ask this question?
Just implemented a round of fixes for Window support that includes a new method for generating a cache folder, and fixes a bunch of windows specific items. Going to close this out (maybe once and for all?) but if anyone still has problems please let us know.
Make it so the following error doesn't happen after upgrading.
(removing /tmp/pestle_cache will fix this)