This is from the shock your co-worker department: There is an easy one-liner to make any composer based project spit “Segmentation fault (core dumped)” regardless of the Composer command entered:
composer config -- vendor-dir '{$bin-dir}'
Smuggle this endless-loop creating Composer config setting into a shy looking commit (update some dependencies and just add this little setting along the way) and push it. When this tainted composer.json
is checked-out, each time composer loads the config part (which happens automatically) and resolves the vendor-dir
setting it will get stuck in an endless loop and then quit with a segmentation fault.
And there is little which creates more question-marks above a PHP developers head when using a command in shell and then seeing a segmentation fault when you just do not need it.
To lift this prank to the next level, offer your help to look into the issue. Create a new shell session and quickly export the environment variable and clear the terminal again:
export COMPOSER_VENDOR_DIR=vendor; clear
In your shell session composer will just behave as if there is no problem. Afterwards close your session. Next time your co-worker will probably start to feel too dumb to use composer again and puzzles about weird system behaviour resulting in unspecified segmentation faults.
Tagged: Composer, PHP, Prank
