Fix empty messages list when register_globals is enabled (#1489157)