Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-29096: Do not store empty draft values in DB #1417

Merged
merged 12 commits into from Mar 11, 2019

Conversation

4 participants
@pkamps
Copy link
Contributor

commented Jan 17, 2019

The issue and steps to reproduce it are described here:
https://jira.ez.no/browse/EZP-29096

Or use those steps:

  • Create a new user account
  • Do not fill any values in the form
  • Close the browser tab
  • Try to create a new user account
  • You will get a transaction error

This patch will prevent the user creation to store any draft data into the DB unless the editor specified a user login.

@andrerom

This comment has been minimized.

Copy link
Member

commented Jan 18, 2019

Nice! 👍

We should aim to place this one 2017.12 and up. As for Travis, unsure why but tests seems to fail with:

.PHP Fatal error:  Call to a member function store() on null in /home/travis/build/ezsystems/ezpublish-legacy/kernel/classes/datatypes/ezuser/ezusertype.php on line 282

@kmadejski kmadejski requested review from andrerom and glye Jan 21, 2019

@glye
Copy link
Member

left a comment

Agree on 2017.12, and we must figure out why that test breaks.

Show resolved Hide resolved kernel/classes/datatypes/ezuser/ezuser.php Outdated
Show resolved Hide resolved kernel/classes/datatypes/ezuser/ezusertype.php Outdated
@glye

This comment has been minimized.

Copy link
Member

commented Jan 21, 2019

onPublish() fails because there is no user object. Seems the code expects the draft to have been stored, so bigger changes are needed.
https://github.com/ezsystems/ezpublish-legacy/pull/1417/files#diff-7c45a8ca23a28df173a64ef5548180c0R282

pkamps and others added some commits Jan 22, 2019

Update kernel/classes/datatypes/ezuser/ezuser.php
Co-Authored-By: pkamps <pkamps@mugo.ca>
Update kernel/classes/datatypes/ezuser/ezusertype.php
Co-Authored-By: pkamps <pkamps@mugo.ca>
@peterkeung

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2019

Are tests passing with the latest commit?

@glye

This comment has been minimized.

Copy link
Member

commented Jan 30, 2019

@peterkeung No, sorry. Don't you have access to see the results? Travis says eZUserTypeRegression::testUpdatePasswordUpdatesSerializedData The password hash stored in the user attribute should have been updated Failed asserting that null is not equal to null.

@glye

glye approved these changes Feb 5, 2019

@glye
Copy link
Member

left a comment

Tests pass! 🎉 🙌
Some CS issues and minor grumbles, and questions about other changes, in particular the getSerializedPasswordHash change.

Show resolved Hide resolved kernel/classes/datatypes/ezuser/ezusertype.php Outdated
// only if the object version is a draft (status == 0)
if(
$user->Login &&
$contentObjectAttribute->attribute( 'object_version' )->attribute( 'status' ) == 0

This comment has been minimized.

Copy link
@glye

glye Feb 5, 2019

Member
Suggested change
$contentObjectAttribute->attribute( 'object_version' )->attribute( 'status' ) == 0
$contentObjectAttribute->attribute( 'object_version' )->attribute( 'status' ) === 0

Or can this be a string? I would not think so.

This comment has been minimized.

Copy link
@pkamps

pkamps Feb 20, 2019

Author Contributor

Hope you don't mind if I ignore it. Maybe it's a string and then it would hurt to be extra strict here.

This comment has been minimized.

Copy link
@glye

glye Feb 21, 2019

Member

We ought to be strict, strictly speaking ;) eZContentObjectVersion says it's an integer. But I see many cases where we aren't strict, so I guess this can pass if others agree.

Show resolved Hide resolved kernel/classes/datatypes/ezuser/ezusertype.php Outdated
Show resolved Hide resolved kernel/classes/datatypes/ezuser/ezusertype.php Outdated
Show resolved Hide resolved kernel/user/ezuseroperationcollection.php Outdated
@andrerom

This comment has been minimized.

Copy link
Member

commented Feb 18, 2019

@pkamps can you accept / reject @glye's fixes?

glye and others added some commits Feb 20, 2019

Update kernel/classes/datatypes/ezuser/ezusertype.php
Co-Authored-By: pkamps <pkamps@mugo.ca>
Update kernel/classes/datatypes/ezuser/ezusertype.php
Co-Authored-By: pkamps <pkamps@mugo.ca>
Update kernel/classes/datatypes/ezuser/ezusertype.php
Co-Authored-By: pkamps <pkamps@mugo.ca>
Update kernel/classes/datatypes/ezuser/ezuser.php
Co-Authored-By: pkamps <pkamps@mugo.ca>
@glye

glye approved these changes Feb 21, 2019

@andrerom
Copy link
Member

left a comment

LGTM

@andrerom andrerom merged commit 1adb33d into ezsystems:master Mar 11, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

andrerom added a commit that referenced this pull request Mar 11, 2019

EZP-29096: Do not store empty draft values in DB (#1417)
* EZP-29096: Do not store empty draft values in DB

(cherry picked from commit 1adb33d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.