Problem/Motivation

One comment on #2863904: Typogrify does not handle langcode properly mentions a PHP message

Notice: Undefined variable: ascii_to_unicode in Drupal\typogrify\Plugin\Filter\TypogrifyFilter->tips() (line 460 of modules/contrib/typogrify/src/Plugin/Filter/TypogrifyFilter.php).

when viewing the help text for this module.

Proposed resolution

This notice comes from the code

        if ($settings['quotes'][$ascii]) {
          $ascii_to_unicode .= $this->t('Converts @ascii to @unicode', array(
            '@ascii' => $ascii,
            '@unicode' => $unicode,
          ));
          $output .= "<li>$ascii_to_unicode</li>\n";
        }

in the file src/Plugin/Filter/TypogrifyFilter.php.

I think all we have to do is replace the .= with =.

Remaining tasks

User interface changes

Fewer PHP messages.

API changes

None

Data model changes

None

Comments

benjifisher created an issue. See original summary.

sastha’s picture

Assigned: Unassigned » sastha
govind.maloo’s picture

Status: Active » Needs review
StatusFileSize
new712 bytes

Changed ".=" to "=" as there is no other place using this variable.

Thanks
Govind

benjifisher’s picture

The patch looks right, so I will call this reviewed but not tested by the community.

suparnaa.dey’s picture

StatusFileSize
new422.75 KB

I have tested @govind.maloo 's patch #3 and can't see this message anymore. RTBC

benjifisher’s picture

Status: Needs review » Reviewed & tested by the community

Based on #4 and #5, I think we can change the status.

benjifisher’s picture

Assigned: sastha » Unassigned
brightbold’s picture

Status: Reviewed & tested by the community » Needs work

After applying this patch, I now get this error:

Warning: Illegal string offset ',,' in Drupal\typogrify\Plugin\Filter\TypogrifyFilter->tips() (line 457 of modules/contrib/typogrify/src/Plugin/Filter/TypogrifyFilter.php).

Drupal\typogrify\Plugin\Filter\TypogrifyFilter->tips(1) (Line: 350)
_filter_tips(-1, 1) (Line: 30)
Drupal\filter\Controller\FilterController->filterTips(NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Sorry to rain on the RTBC parade.

benjifisher’s picture

Status: Needs work » Reviewed & tested by the community

@BrightBold:

That is a separate problem, and we already have an issue for it: #3024642: PHP warning when viewing help text. There is already a patch on that issue that hides the problem, but I marked it NW because I want to see a better fix.

Back to RTBC.

  • govind.maloo authored 0fbcca9 on 8.x-1.x
    Issue #3024641 by govind.maloo, suparnaa.dey, benjifisher, BrightBold:...
benjifisher’s picture

Status: Reviewed & tested by the community » Fixed

Fixed (and it was less than a year since the previous comment).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.