Probably you were using old PHP version until and now upgraded PHP thats the reason it was working without any error till now from years.
until PHP4 there was no error if you are using variable without defining it but as of PHP5 onwards it throws errors for codes like mentioned in question.