Skip to content


Subversion checkout URL

You can clone with
Download ZIP


JTable doesn't update a field with a null value #364

zian974 opened this Issue · 5 comments

5 participants


It is impossible for me to update a table with JTable and assign a null value for a field.
I think the problem is the processing of data in the bind () function of Table.php, more precisely in the foreach loop, at:
if (isset ($ src [$ k])) {
$ this-> $ k = $ src [$ k];
If the value is null, the assignment will never happen.

I need to put a null on a foreign key without any error FOREIGN_KEY_CHECKS

I tried replacing
if (isset ($ src [$ k]))
if (isset ($ src [$ k]) | | (is_null ($ src [$ k]) & & array_key_exists ($ k, $ src)))

and it works for now.


Wow I think this is happening for me as well when trying to save a blanked out article.


Actually I think this is because $updateNulls is set to false in the content table

Also #1077 although that has to do with a different table.


Actually this is feature (or issue) in bind() function itself, which prevents updating values that do not exist.

In PHP isset() returns false either if the value doesn't exist or is null. It's very useful for example when you may have optional input fields, which do not always come from GET or POST (are set but not defined). Changing this undocumented feature could potentially slightly break many extensions (and core) which rely on this feature.

If table needs some other behavior, I'd rather override the function with a version that works better for that table. Forcing bind() change to all tables may have catastrophic consequences on many extensions as it's breaking the current API.


Okay I found the problem in JTableContent which is that it was using !empty rather than isset for a condition and that was leading to other consequences


So, has this been fixed in the CMS or a previous iteration of the Platform then?


I'm sorry but we aren't accepting issues for this repository any more. Please see for how to report and issue for the CMS Platform.

@eddieajau eddieajau closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.