If a developer does a get_data() test before is_cancelled(), get_data will return true rather than reflecting the fact the form was cancelled.
Steps to reproduce:
1) Install attached test script in Moodle root
2) Call http://mymoodle/testmformscancel.php
3) Press the cancel button
'got cancelled' is printed.
'got data' is printed
A proof of concept patch is available here: