Figured it out. This is not a bug with PHP (though it used to be) – it’s a bug in some versions of phpmyadmin. The same bug intermittently reappears and is then fixed in various subversions (see above):
#1312 - PROCEDURE [name] can't return a result set in the given context
This behavior appears limited to SELECT statements within stored procedures inside phpmyadmin.
Using a client like MySQL Workbench works around the problem (or you could upgrade phpmyadmin, but that’s a pain if you’re on a shared server like I am).
Anyway, thanks to everyone for your help.