PHP Action Plugin

This is not true in general - is this a PHP limitation?

There is a limitation on the size of the environment variables, but it is larger than 32k.

Keyboard Maestro restricts the size of the environment variables to 100k, which is below that allowed by OS X in every version I am aware of.

Keyboard Maestro limits the size by deleting the largest variables until the size of the remaining variables fits within 100k.

So delete the variables in the script before executing php (presumaing it is a php limit).

I refer again to the Halting Problem which in general proves it is impossible to know the extent of any Turing-complete program (which includes Keyboard Maestro macros), to know whether it ever finishes, and to know what the limits are on what it might use. So any attempt I made to restrict variables to only "those used by the macros" would be inaccurate.

As far as restricting it to just the variables on a provided list, if you need less than all the variables, then delete them yourself within the script. The only case this would fail for would be if the script needed a large variable, that Keyboard Maestro had already deleted, but that could nonetheless fit within the environment if other smaller variables were deleted - and frankly this is such a limited use case as to be not worth handling.

If you really need a large variable passed to a script, write it to a file, and read it in the script.

No, it really could not. Not accurately or correctly in the general case - it is impossible (not just difficult, but actually proved to be impossible).

Implementing difficult things is something I try to avoid, but I will do it on occasion. Implementing impossible things I draw the line at.

I don't know. This was just a Google result. Not sure under which conditions it applies.

I see. Thanks for the clarification.

Read this paragraph multiple times, and tried to read the Wikipedia article you linked to. I don't understand any of it. But you built Keyboard Maestro. If you say it's impossible, it's impossible.

Great tip. That's what I'll do in the future. Problem solved. Thanks!