avatar brianteeman
brianteeman
12 Dec 2014

Just tried to apply a category to an issue and got the following error

Cannot add or update a child row: a foreign key constraint fails (`issuesj_tracker`.`ec7hm_issues`, CONSTRAINT `ec7hm_issues_fk_milestone` FOREIGN KEY (`milestone_id`) REFERENCES `ec7hm_tracker_milestones` (`milestone_id`) ON DELETE SET NULL ON UPDATE CASCAD) -- SQL -- UPDATE `ec7hm_issues` SET `issue_number`='5408',`foreign_number`=NULL,`project_id`='1',`milestone_id`='0',`title`='Use the allowed example domain',`description`='<p>This PR change the text to use the correct example domain example.org and also some minor CS issues.</p>',`description_raw`='This PR change the text to use the correct example domain example.org and also some minor CS issues.',`priority`='3',`status`='3',`opened_date`='2014-12-12 07:42:20',`opened_by`='zero-24',`closed_date`='0000-00-00 00:00:00',`closed_by`=NULL,`closed_sha`=NULL,`modified_date`='2014-12-12 23:52:40',`modified_by`='brianteeman',`rel_number`='0',`rel_type`='0',`has_code`='1',`pr_head_user`='',`pr_head_ref`='',`labels`='29',`build`='staging',`easy`='0',`merge_state`='',`gh_merge_status`='',`commits`='' WHERE `id`='6104'
avatar brianteeman brianteeman - open - 12 Dec 2014
avatar mbabker
mbabker - comment - 13 Dec 2014

The query here is failing because it is trying to set milestone_id and rel_type to 0 instead of NULL. The 0 value violates the foreign keys on the columns; there isn't a reference ID with those values.

avatar mbabker
mbabker - comment - 13 Dec 2014

Issue is here - https://github.com/joomla/jissues/blob/master/src/App/Tracker/Controller/Issue/Save.php#L66 - The values getting sent with the save request it appears aren't matching up with the expected values in the database.

avatar mbabker
mbabker - comment - 13 Dec 2014

The data getting POSTed isn't right. The two problem columns and the post data for the item I'm testing against:

["rel_type"] => string(0) ""
["milestone_id"] => string(12) "No Milestone"

rel_type is getting converted to a 0 when processed through Joomla\Filter\InputFilter as an integer, same with the milestone_id.

avatar mbabker mbabker - reference | - 13 Dec 14
avatar mbabker
mbabker - comment - 13 Dec 2014

I rolled back the updated joomla/filter package for the time being. A change was made to the default values of a few masks (integers specifically) which changed them from null to 0. With that change, our data validation fails; the incorrect values are getting POSTed (as shown above) but with the changes to the defaults, what was previously set as null was now being assigned a value with meaning in the database. The rel_type and milestone_id columns at a minimum appear need to be updated to submit the proper data.

avatar brianteeman
brianteeman - comment - 13 Dec 2014

Thanks

On 13 December 2014 at 00:51, Michael Babker notifications@github.com
wrote:

I rolled back the updated joomla/filter package for the time being. A
change was made to the default values of a few masks (integers
specifically) which changed them from null to 0. With that change, our data
validation fails; the incorrect values are getting POSTed (as shown above)
but with the changes to the defaults, what was previously set as null was
now being assigned a value with meaning in the database. The rel_type and
milestone_id columns at a minimum appear need to be updated to submit the
proper data.


Reply to this email directly or view it on GitHub
#579 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar wilsonge
wilsonge - comment - 13 Dec 2014

It's definitely not my fault :( I blame anyone except me!

avatar wilsonge
wilsonge - comment - 14 Dec 2014

I don't have a local copy of this set up to test with but I think I've got a more permanent fix in #581

avatar elkuku
elkuku - comment - 14 Dec 2014

I don't have a local copy of this set up to test with

Could this be an option?

avatar elkuku elkuku - close - 3 Feb 2015
avatar elkuku elkuku - close - 3 Feb 2015
avatar elkuku elkuku - change - 3 Feb 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-02-03 02:05:00

Add a Comment

Login with GitHub to post a comment