alfred-encode-decode-workflow icon indicating copy to clipboard operation
alfred-encode-decode-workflow copied to clipboard

Problem with macOS 12.0.1

Open wym572 opened this issue 4 years ago • 14 comments
trafficstars

After installing php with brew, and set language to "/opt/homebrew/bin/php" I get these using encode: image

wym572 avatar Oct 19 '21 11:10 wym572

After installing php with brew, and set language to "/usr/local/bin/php"

PHP Version: PHP 8.0.12 (cli) (built: Oct 21 2021 14:38:26) ( NTS )

Alfred Version: Alfred 4.6 [1266]

I get these using encode:

image

philipbo avatar Nov 04 '21 14:11 philipbo

After installing php with brew, and set language to "/usr/local/bin/php"

PHP Version: PHP 8.0.12 (cli) (built: Oct 21 2021 14:38:26) ( NTS )

Alfred Version: Alfred 4.6 [1266]

I get these using encode:

image

hi,I have a solution.

first, you must make sure PHP is installed。If not, you can run

brew install php

then, you should edit script filter. For encode script, edit as

/usr/local/bin/php encode.php $1

like

截屏2021-11-05 下午3 56 01

fg6a5gf avatar Nov 05 '21 07:11 fg6a5gf

@Zhengxiuhang thanks, it's work. #25

setting: with input as argv

encode: /usr/local/bin/php encode.php $1

decode: /usr/local/bin/php decode.php "$(./normalise -form NFC "$1")"

philipbo avatar Nov 05 '21 11:11 philipbo

Same issue here. No matter with argument or query.

WX20211201-112359@2x WX20211201-112459@2x

PHP version: PHP 8.0.13 (cli) (built: Nov 19 2021 08:51:23) ( NTS ) Alfred version: 4.6.1 Mac OS version: Monterey 12.0.1 Architecture: Apple M1

hoyangtsai avatar Dec 01 '21 03:12 hoyangtsai

+1 for me. I fixed some of the errors in workflows.php, but gave up after a bit. Looks like the new php doesn't like it.

PHP 8.1.0 (cli) (built: Nov 28 2021 01:44:44) (NTS) macOS 12.0.1 (21A559) Alfred 4.6.1 [1274]

cameronsstone avatar Dec 08 '21 05:12 cameronsstone

I got the same problem, honestly not using php for anything else than PHP so I unlinked the previous version and installed [email protected] and it works.

So the steps after having PHP installed and upgraded to 8.1.0 from brew I followed are:

I also have updated the php as described in the project Readme changing php to /usr/local/bin/php.

robertovg avatar Dec 09 '21 13:12 robertovg

Thanks to @robertovg for correctly pointing out that the issue is, currently, that the workflow is incompatible with newer versions of PHP.

However, instead of the potentially disruptive workaround of force-linking PHP 7.4 brew-wide, I was able to get everything working just by passing in the versioned, non-linked keg path:

/opt/homebrew/opt/[email protected]/bin/php decode.php "$(./normalise -form NFC "$1")"

apetresc avatar Jan 05 '22 18:01 apetresc

Got it working (I'm now on macOS 12.1, Alfred 4, which may have broken more things):

  1. brew install [email protected]
  2. link to php in keg for both encode and decode Script Filters - for me it was /usr/local/opt/[email protected]/bin/php
  3. hack workflows.php:
    1. Change line 307 (defaults read) to exec( 'plutil -extract '.$a.' raw "'. $b .'"', $out ); // Execute system call to read plist value (defaults read from filepath seems to have stopped working, though the manpage still says that's not happening until "an upcoming major release".
    2. Update cache partial path in line 41 to /Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/ (instead of Alfred-2 which doesn't exist for me and the script doesn't create it if missing.
    3. [Optional] Update workflow partial data path from Alfred-2 to Alfred

cameronsstone avatar Jan 13 '22 19:01 cameronsstone

I got the same problem, honestly not using php for anything else than PHP so I unlinked the previous version and installed [email protected] and it works.

So the steps after having PHP installed and upgraded to 8.1.0 from brew I followed are:

I also have updated the php as described in the project Readme changing php to /usr/local/bin/php.

it works, here is my settings: image

pofycn7639 avatar Mar 08 '22 08:03 pofycn7639

can anybody fix the php version bug? I want to use the lastest php version!

wteng avatar Mar 25 '22 10:03 wteng

The reason it does not work with latest PHP versions is that an issue that previously was a notice (accessing a non-existing index) became a warning in PHP 8, making the output no longer be valid JSON.

A relatively easy workaround to get it to work with PHP 8 is to suppress warnings altogether:

php -d error_reporting="E_ERROR | E_PARSE" encode.php "$(./normalise -form NFC "{query}")"

loilo avatar Sep 19 '22 20:09 loilo

I got the same problem, honestly not using php for anything else than PHP so I unlinked the previous version and installed [email protected] and it works.

So the steps after having PHP installed and upgraded to 8.1.0 from brew I followed are:

I also have updated the php as described in the project Readme changing php to /usr/local/bin/php.

That's good for me. In fact no need to unlink-php,just need change 'php' to '/opt/homebrew/opt/[email protected]/bin/php'

jeonhei avatar Nov 02 '22 09:11 jeonhei

Hello, I used to use willfarrell/alfred-encode-decode-workflow, but it required php@7, and macOS removed php@7 now. I'm waiting for a long time, but it seems that the author has no time to update it. So I decided to write a new one. It must be simple and have no dependencies.

Ande the new one is here. https://github.com/alswl/alfred-workflow-encode-decode

It's written in Python, and it's simple and easy to use, and maybe you can use this one now. Thanks a lot for the author of willfarrell/alfred-encode-decode-workflow.

alswl avatar Jun 18 '23 12:06 alswl

Here is how I solved this issue (Monterey 13.4 running on an M1 chip).

The Encode/Decode Alfred workflow requires PHP version 7.4 in order to work.
However, I already have version 8.1 installed.
Here is the workaround.

  • I previously installed the latest PHP (version 8.1 back in the day)
    brew install php
    
  • Install PHP version 7.4 using a tap so that both versions can coexist
    brew tap shivammathur/php
    brew install shivammathur/php/[email protected]
    
  • Edit the Encode/Decode Alfred workflow
    • Double-click the encode and decode filters Replace php with /opt/homebrew/opt/[email protected]/bin/php

ebouchut avatar Jun 18 '23 15:06 ebouchut