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