Attribute1 flags wrong (read and write)
I still got the bitwise comparison of the attribute1 flags wrong. They're packed as type "V" (unsigned long (always 32 bit, little endian byte order)) Then compare to hex flags without any converting, but convert string output to integer to not count zeros:
if ( intval( $msg['attribute1'] & $this->attributes[$a] ) <> 0 )