Using %d macro returns "Array"
Using %d macro returns "Array"
Description
When using date macro, the word "Array" is returned instead of the date.
Distribution Name and Version
Debian
FusionDirectory Version
1.4-2~jenkinsbuild570
Steps to Reproduce
- Create a template
- Set
%d|%
in an attribute
Expected behavior:
Attribute value is set to current date
Actual behavior:
Attribute value is set to Array
Reproduces how often:
100%
Link issues together to show that they're related. Learn more.
Activity
- bmortier added Bugs fusiondirectory-core labels
added Bugs fusiondirectory-core labels
The fix is easy:
diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc index 55152ba5..c33a4140 100644 --- a/include/class_templateHandling.inc +++ b/include/class_templateHandling.inc @@ -427,7 +427,7 @@ class templateHandling /* Special handling for shadowExpire: days since epoch */ return [floor($dateObject->format('U') / 86400)]; } - return [$dateObject->format($args[1])]; + return $dateObject->format($args[1]); } private static function modifierNumber (array $args)
By coudot on 2020-02-02T20:52:13 (imported from GitLab)
- bmortier changed milestone to %FusionDirectory 1.4
changed milestone to %FusionDirectory 1.4
By bmortier on 2020-02-02T20:59:07 (imported from GitLab)
- bmortier changed due date to February 04, 2020
changed due date to February 04, 2020
By bmortier on 2020-02-02T20:59:11 (imported from GitLab)
- bmortier mentioned in merge request !735
mentioned in merge request !735
By Côme Chilliet on 2020-02-04T08:24:12 (imported from GitLab)
- bmortier created merge request !735 to address this issue
created merge request !735 to address this issue
By Côme Chilliet on 2020-02-04T08:24:13 (imported from GitLab)
For me the problem is when calling modifierDate, an extra array layer is added: https://gitlab.fusiondirectory.org/fusiondirectory/fd/blob/1.4-dev/include/class_templateHandling.inc#L568
But I do not understand why we did not encounter this problem before as this behavior is not new.
By Côme Chilliet on 2020-02-04T09:00:26 (imported from GitLab)
So, the issue was there before but not causing problems until #5882 (closed) changes.
By Côme Chilliet on 2020-02-04T10:11:09 (imported from GitLab)
- bmortier added 1h of time spent at 2020-02-04
added 1h of time spent at 2020-02-04
By Côme Chilliet on 2020-02-04T11:16:21 (imported from GitLab)
- bmortier added To Be Tested label
added To Be Tested label
- bmortier assigned to @jswaelens and unassigned @MCMic
assigned to @jswaelens and unassigned @MCMic
By Côme Chilliet on 2020-02-04T11:16:21 (imported from GitLab)
- bmortier assigned to @coudot and unassigned @jswaelens
assigned to @coudot and unassigned @jswaelens
By bmortier on 2020-02-04T11:19:49 (imported from GitLab)
- bmortier closed
closed
By Côme Chilliet on 2020-02-04T13:39:42 (imported from GitLab)
- bmortier added Fixed label and removed To Be Tested label
added Fixed label and removed To Be Tested label
- bmortier removed due date
removed due date
By bmortier on 2020-04-22T12:26:37 (imported from GitLab)