However, it doesn't seem to be related to the moodle version, the code seems to be written with the assumption the database used is MySQL, or a database that will implicitly perform type conversion.
In our instance of PostgreSQL a query like:
SELECT * FROM mdl_wwassignment WHERE id=''
will fail because an integer is being compared to a string (while MySQL appears to perform an implicit type conversion which makes it work)
As a result code like:
$DB->get_record('wwassignment', array('id'=>$wwassignmentid ));
fails when $wwassignmentid is set to '' (such as when a new WeBWorK Problem Set is added to a course).