evolution-cms / evolution

Welcome to the new evolution of MODX Evolution!
GNU General Public License v3.0
260 stars 96 forks source link

Error When Saving Manager User in EVO 1.4.17 #2092

Closed nikokyritsis closed 1 year ago

nikokyritsis commented 2 years ago

I'm seeing a SQL error when editing a Manager User's password and trying to save, with a wrong type for the dob field. The issue stems from the DOB field, which displays "-" as the field value if none is set (dob field set to 0 in the db). It looks like the issue started after the PHP8 fix commit, which changed the field value:

<?php echo($userdata['dob'] ? $modx->toDateFormat($userdata['dob'], 'dateOnly') : ""); ?>

to

<?php echo(isset($userdata['dob']) ? $modx->toDateFormat($userdata['dob'], 'dateOnly') : ""); ?>

Since the default behavior has the dob set to 0, isset is returning true and the dateOnly mode causes the value to return '-'. A potential fix would be to include an OR check for the dob being set to 0 in mutate_user.dynamic.php or to change the behavior of the toDateFormat function in document.parser.class.inc.php to return an empty string instead of a dash.