? Success

User tests: Successful: Unsuccessful:

avatar alikon
alikon
7 Mar 2015

Steps to reproduce the issue

go to the Redirect manager and create a new link and Save

Expected result

the redirect link is saved

Actual result

SQL ERROR not null constraint violation

System information

PostgreSQL 9.3.5
Joomla 3.4.0

Additional comments

added a sanity check for NOT NULL FIELDS
fix #6349

avatar alikon alikon - open - 7 Mar 2015
avatar joomla-cms-bot joomla-cms-bot - change - 7 Mar 2015
Labels Added: ?
avatar wilsonge
wilsonge - comment - 7 Mar 2015

This is one of the cases where the field should be able to be nullable (this condition can actually be seen really easily - https://github.com/joomla/joomla-cms/blob/staging/plugins/system/redirect/redirect.php#L122). If $_SERVER['HTTP_REFERER'] is empty we set it to be an empty string and as we know that's null in non-mysql db's

avatar alikon
alikon - comment - 7 Mar 2015

let me disagree
when you add a new redirect link from the Redirect manager component in the backend and save data
that plugin event is not triggered
so if you don't set $this->referer = ''; you get this error

Save failed with the following error:
 SQL=INSERT INTO "scaku_redirect_links" ("old_url","new_url","comment","published","created_date","modified_date") VALUES ('aaaa','aaaaaaa','',1,'2015-03-07 18:03:54','2015-03-07 18:03:54') 
avatar wilsonge
wilsonge - comment - 7 Mar 2015

In the case where you manually add a new link there is no referring URL of course. So surely that's another reason to remove the NOT NULL in the database?

avatar brianteeman brianteeman - change - 7 Mar 2015
Category Postgresql
avatar alikon
alikon - comment - 9 Mar 2015

in my opinion the best thing to do is a complete review of our data model , if we change our constraints on spot
we are going to loose the overall picture
#6265 (comment)

avatar waader
waader - comment - 14 Mar 2015

@test works on postgresql, mysql, mssql. Thanks @alikon!

@wilsonge and @alikon Your arguments are both valid logically or practically. I am in the practical camp. In the end we have come to a decision.

avatar brianteeman
brianteeman - comment - 24 Mar 2015

@test issue confirmed on pg and the fix resolves that


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6355.
avatar orware
orware - comment - 9 Apr 2015

@alikon

I've tested this one successfully, however I would like to make one quick change suggestion to this PR.

I noticed above in your comment on March 7 you mentioned setting the referer to an empty string, but in the PR it looks like you're setting it to a string containing a single space.

At first I thought the space was needed for some reason but I tested with an empty string and that appeared to work just fine so I think there just may be a typo in the PR.

If that's updated I have no objections on this one and it does fix the issue.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6355.
avatar orware orware - test_item - 9 Apr 2015 - Tested successfully
avatar orware
orware - comment - 9 Apr 2015

(Just for clarity, my test was performed on Postgres to confirm the error and fix and then I tried it also in MySQL, which isn't exhibiting the issue currently, but applying the fix doesn't introduce any issues on the MySQL end).

Additionally:
Another possible solution for this sort of problem (which could potentially be tackled in the future, I still approve the current fix for this issue proposed by @alikon) would be to make greater use of the information that the getTableColumns() methods can return in our database drivers and use that to automatically set empty string values for these types of columns when they are detected (so instead of the additional code being needed in the JTable class, it could potentially be fixed at the database driver level within the insertObject() method used by the JTable classes).screen shot 2015-04-08 at 21 41 10screen shot 2015-04-08 at 21 41 10


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6355.
avatar orware orware - test_item - 9 Apr 2015 - Not tested
avatar orware orware - test_item - 9 Apr 2015 - Tested successfully
avatar brianteeman
brianteeman - comment - 23 May 2015

tested again still works


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6355.

avatar brianteeman brianteeman - test_item - 23 May 2015 - Tested successfully
avatar brianteeman brianteeman - change - 23 May 2015
Status Pending Ready to Commit
avatar brianteeman
brianteeman - comment - 23 May 2015

Setting RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6355.

avatar brianteeman brianteeman - change - 23 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 2 Jul 2015
Milestone Added:
avatar zero-24 zero-24 - change - 2 Jul 2015
Milestone Added:
avatar Kubik-Rubik
Kubik-Rubik - comment - 9 Jul 2015

Thank you @alikon! Merged.

avatar zero-24
zero-24 - comment - 9 Jul 2015

@Kubik-Rubik is there a reason to let this PR open?

avatar zero-24
zero-24 - comment - 9 Jul 2015

Or did you comment on the wrong itm?

avatar Kubik-Rubik
Kubik-Rubik - comment - 9 Jul 2015

No, I just forgot to add "Fixes" to the commit so GitHub didn't close it automatically... the commit is here: 6715323

avatar Kubik-Rubik Kubik-Rubik - change - 9 Jul 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-07-09 08:14:01
Closed_By Kubik-Rubik
avatar Kubik-Rubik Kubik-Rubik - close - 9 Jul 2015
avatar Kubik-Rubik Kubik-Rubik - close - 9 Jul 2015
avatar zero-24 zero-24 - close - 9 Jul 2015
avatar zero-24
zero-24 - comment - 9 Jul 2015

:+1:

avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment