> This specific issue doesn't seem to be related to the emulation. As far as I understand, PDO parses SQL as well in order to replace positional placeholders and vise versa depending on the input and the target platform capabilities.
True, PDO has a huge flaw because of its SQL parser. In non-emulation mode PDO will attempt to only replace named parameters with ?. This leaves a much smaller vector for bugs. How many people put : in their SQL? With a context-aware parser, we could minimize this to close to zero. > I tried running the example on the stock PHP 8.0.3, and regardless of the emulation mode and NO_BACKSLASH_ESCAPES mode I saw the same error: I don't think this is possible. I executed it with PHP 8.0.3 and it only fails in emulation mode. > With my patch, I don't expect to see any changes in parsing MySQL queries so I don't understand how it's relevant. Am I missing something? Which is kind of my point. You are attempting to fix a small issue in another driver while the MySQL parser is already broken with similar bugs. If we are going to have diverging parsers then they should be entirely split up. Keeping a single parser will lead to more bugs. If we try to patch like this then it will soon get out of hand.