Verified Commit 8abb2835 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3392200 by jeremy_p, joachim, hdnag, yepa: Invalid placeholder error...

Issue #3392200 by jeremy_p, joachim, hdnag, yepa: Invalid placeholder error message should say what's wrong with it
parent 4f47df39
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ protected static function placeholderFormat($string, array $args) {
        default:
          if (!ctype_alnum($key[0])) {
            // Warn for random placeholders that won't be replaced.
            trigger_error(sprintf('Invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_WARNING);
            trigger_error(sprintf('Placeholders must begin with one of the following "@", ":" or "%%", invalid placeholder (%s) with string: "%s"', $key, $string), E_USER_WARNING);
          }
          // No replacement possible therefore we can discard the argument.
          unset($args[$key]);
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ public function testUnexpectedPlaceholder($string, $arguments, $error_number, $e
   */
  public function providerTestUnexpectedPlaceholder() {
    return [
      ['Non alpha, non-allowed starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"'],
      ['Non alpha, non-allowed starting character: ~placeholder', ['~placeholder' => 'replaced'], E_USER_WARNING, 'Placeholders must begin with one of the following "@", ":" or "%", invalid placeholder (~placeholder) with string: "Non alpha, non-allowed starting character: ~placeholder"'],
      ['Alpha starting character: placeholder', ['placeholder' => 'replaced'], NULL, ''],
      // Ensure that where the placeholder is located in the string is
      // irrelevant.