Closed bondjimbond closed 4 years ago
@bondjimbond Your fix works as you describe, with nothing left in the log. WRT your question:
Question: should we introduce some lines to report to the administrator what the problem is? Is this a watchdog error that runs during the replacement process, or is it something we can catch when saving your config via the admin form?
I would prefer to validate the values entered in the form. I think all we'd need to do is make sure each one contains a |
.
Agreed. I have added form validation, which I've tested and is working. I left the original fix in, as it deals with any legacy values that might already exist. Does this satisfy?
Yup, tested and it works. Merging.
Huzzah
Error noted in #32:
What does this Pull Request do?
Currently, if user forgets to include the
|
character in the list of replacements, result is an Undefined Offset error which is written to the logs. Given how the module works, this means hundreds of Undefined Offset errors every hour on a busy site.This PR checks each replacement string to make sure the
|
is actually present, before it tries to explode it.What's new?
In the two Replacement fields, code is introduced to check for the presence of the
|
before attempting to explode and replace. If the|
is not present in that particular string, the replacement process is skipped.How should this be tested?
Configure your text replacements as normal, in a way that should generate results. Run a search and confirm that replacements are happening.
In one of your replacements, remove the
|
and re-run your search. Check the Drupal log and see the Undefined Offset error.Check out this PR and re-run the search. No error reported.
Question: should we introduce some lines to report to the administrator what the problem is? Is this a watchdog error that runs during the replacement process, or is it something we can catch when saving your config via the admin form?
Interested parties
@mjordan