>>> $dbr->isWriteQuery( 'SELECT foo' ); => false >>> $dbr->isWriteQuery( ' SELECT foo' ); => true
Yes there probably shouldn't be leading whitespace in a query but the failure mode is weird, because it throws an exception for trying to do a write query on DB_REPLICA. Seen in the SelectCategory extension.