I have prepared a fix for this issue. Shall I merge it with MAINT_4_0_0 (in order for an rc4), or is QA_4_0 (for 4.0.1) sufficient? TBH I consider this bug to be blocking.
I have pushed my fix to my fork: https://github.com/mynetx/phpmyadmin/tree/MAINT_4_0_0
Feel free to merge and/or re-apply the patch: https://github.com/mynetx/phpmyadmin/commit/ff2d22f.patch
J.M.