You didn't provide sample input but in your first example your double quotes are allowing the `disallowedBlockNames` variable to be expanded by your shell _before_ it is used by `grep`. I'm assuming this is a variable set in your php code and does not exist in your shell and therefore it is expanding to nothing. So what you are really sending to grep is:
grep -r "protected = array('install/end');" app/
In the second example the single quotes prevent the shell from expanding the variable.