There is an error when viewing a node with Read time rendered which doesn't have calculated read time value. Wrong variable name is used in code to save calculated value to database ($read_time instead of $time on read_time.module@135).
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3051696-13.patch | 708 bytes | antonnavi |
Comments
Comment #2
petersykora commentedComment #3
petersykora commentedComment #4
jigariusI tried the patches above, but still I get an error like:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">InvalidArgumentException</em>: $string ("Read time: :read_time") must be a string. in <em class="placeholder">Drupal\Core\StringTranslation\TranslatableMarkup->__construct()</em> (line <em class="placeholder">132</em> of <em class="placeholder">core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php</em>).I simply enabled the module and enabled read time on node.article.
Comment #5
valthebald$display argument that is passed to t(), can be either string or TranslatableMarkup. Second case must be explicitly casted to string.
Comment #6
valthebaldActually... it makes more sense to remove t() wrapper from read_time_defaults() - there is no need to double-wrap the display string with t()
Comment #7
a3hill commentedUsed patch #2 but preferred to use https://www.drupal.org/project/read_time/issues/3068116 to address the issue in comment #4.
Comment #8
valthebaldComment #9
valthebaldDuplicate of #3068116: The website encountered an unexpected error.
Comment #10
dqdSorry, but we have a D.O. recommendation following generally to close the newer issue in case of a duplicate.
@valthebald: what do you mean by "double" wrap? I do only see one t() wrapping here?
Comment #11
dqdhttps://www.drupal.org/files/issues/2019-07-08/3051696-6.patch applied cleanly but we need more opinions on if this is the right way to solve it.
Comment #12
dqdAdditionally we get
A non-numeric value encounterederror now when cron runs, so string is maybe still an issue...Comment #13
antonnaviHello all here!
I had
A non-numeric value encountered ..error after #6 patch apply.But a combination of #2 & #6 fixed the issue for me.
Combined patch is attached to the comment.
Comment #20
joco_sp commentedThank you all for the help. This will be finally available in the next release.
Comment #22
dqdErrm, ok, this is hard to follow from here. Why there is nothing committed?
Comment #23
joco_sp commentedI followed those instructions - https://www.drupal.org/project/read_time/git-instructions. Everything was deployed and it worked, so I didn't bother with this notification, because I used the suggested git commit command and I thought this will be done automatically. I see now that there are some new instruction on forking the project (Creating issue forks and merge requests). Will do that in the future. @diqidoq thank you for pointing that out.
FYI: It was committed to read_time 2.0.0-beta1 on 13 Nov 2021.