User tests: Successful: Unsuccessful:
Pull Request for Issue that leads to a problem for some developers.
Here you are more information.
https://groups.google.com/forum/#!topic/joomla-dev-general/KZFM8yKZYpg
http://forum.joomla.org/viewtopic.php?f=615&t=775779
This PR fixes an issue that causes an error when someone would like to store NULL value to table columns, using JTable.
I removed the variable $updateNulls because JTableAsset causing the error. Furthermore, the object does not need this variable because there are no columns in _#_assets where you can store NULL value.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
I will try to explain it better. :)
If I would like to store data using JTable, and I would like to store NULL in my columns, I will use $row->store(true).
Some developers do not use JModelAdmin->save() and JTable->save(). They use JTable->store for that reason.
Here you are an example how I only use store(), not save().
There is no problem with JModelAdmin. I just gave it as example where you can test what will happen when perform $table->store with TRUE as parameter.
If you perform $table->store(true) on line 1181 it will catch the error on line 1196. Look at the second screenshot.
To prevent this error, I will have to put $table->store(true) in try-catch.
The problem is the object $asset on line 846.
The object $asset has property 'alias'.
If the parameter $updateNulls is TRUE ($asset->store(true)), the object tries to store NULL value of its property 'alias' in table '#__assets'.
However, there is no column 'alias' in '#__assets'. Furthermore, there are no columns where you will be able to store NULL values in '#__assets'. So, the property $updateNulls on line 846 is redundant.
If you remove it, that will fix this issue and developers will be able to use $table->store(true) without try-catch. :)
should this PR be tested?
It should be tested and merged.
That will be a solution for the mentioned problem.
https://groups.google.com/forum/#!topic/joomla-dev-general/KZFM8yKZYpg
http://forum.joomla.org/viewtopic.php?f=615&t=775779
You can test it easy. Just add "true" as parameter of $table->store() on line 1181.
That will occur the error that you can see on the second screenshot above.
That happens when we use $table->store(true) to store entities by our extensions. It only happens when we use ACL roles in our extensions. It seems, JTable creates asset records when we use roles for our entities.
That is really strange bug, difficult for detecting because it only occurs when someone use $table->store(true) in extensions with implemented ACL roles. :)
However, it is easy for fixing. You have to remove the redundant $updateNulls on line 846 .
I have tested this item
I told you, it is hard to catch the error. :) You can save an article but the error still exists.
I did a video that shows you how to test with an article.
The second video shows the result when we use $table->store(true) with assets in our extensions.
My arguments for removing $updateNulls on line 846 in file libraries/joomla/table/table.php are:
Test with an article
https://www.youtube.com/watch?v=86mlgxa4CxY
Result in our extensions when we use $table->store(true) with assets.
https://www.youtube.com/watch?v=dLtXo9UBsro
Closing this as it is going nowhere
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-10 12:43:06 |
Closed_By | ⇒ | brianteeman |
I don't understand what you are doing here. First you say it can't be null. But then you say this fix allows people to store nulls. This code just feels very very wrong to me.