I've just had this:
Notice: Undefined property: Drupal\Core\Language\Language::$language in Drupal\typogrify\Plugin\Filter\TypogrifyFilter->process() (line 317 of /var/www/yaffs/web/modules/contrib/typogrify/src/Plugin/Filter/TypogrifyFilter.php). array(36)
My site is a development site which I installed with Drupal console. It's in English, but I can't ever remember setting a default language, and line 317 should work...
if ($langcode == 'und') {
$language = \Drupal::languageManager()->getCurrentLanguage();
// @fixme, check language business for d8
$ctx['langcode'] = $language->language; // This is line 317.
}
else {
$ctx['langcode'] = $langcode;
}
I have no default locale set.
I do not have the Language module enabled. This is probably the root cause.
Comments
Comment #2
jeff veit commentedRunning D8.2.7
Comment #3
pcranston commentedI was getting this same notice within Views. I also don't have Locale installed, and it's an English language site. For me, I fixed the issue by changing that line 317 to:
$ctx['langcode'] = 'en';and it works fine now. More of a hack than an official fix though.
Comment #4
benjifisherI was not able to reproduce the problem: for me,
$langcodeis already set to "en", not "und". I even tried downgrading to Drupal 8.2.7. But I tested that code path, and the attached patch should fix the problem. It would be good to get testing from someone who saw the problem.Comment #5
brightboldThe patch in #4 solved the problem for me. Thanks Benji!
Comment #6
benjifisher@BrightBold: Thanks for testing!
Comment #7
brightboldHmm, I'm now getting two new errors which may be unrelated, but I thought I'd mention them here in case there's a possibility they were caused by this patch. (If not, I'll open a new issue.)
Comment #8
benjifisher@BrightBold:
That looks like a separate error. If you un-apply this patch, do you still get that error? Or do you not get that far?
It looks pretty harmless, since the
tips()method just generates the help text about the filter.What version are you using? (Likely choices are 8.x-1.0-alpha1 and 8.x-1.x.) Are you using any other patches?
Some lines from approximately the right place are
The
$ascii_to_unicodevariable does not appear anywhere else, so the$ascii_to_unicode .= ...line is probably responsible for the Notice. The warning comes from$settings['quotes'][$ascii]when$asciiis the string',,'.If you only started seeing these messages now, I think it is either because you are using a different version of PHP or you have changed your error-reporting level.
Comment #9
brightboldAs I am unhelpfully reporting this information to you verbally right now, I will also document it in the issue queue:
Comment #10
benjifisherI just added #3024642: PHP warning when viewing help text and #3024641: Undefined variable notice when viewing filter help text for the two problems you reported. (I am pretty sure it is two separate issues.) One of them is a Novice issue, so someone is likely to work on it pretty soon.
Comment #11
brightboldThanks Benji!
Comment #12
wim leersTested, and confirming RTBC! 🥳
Comment #13
cobenashTested.
Confirmed.
Comment #15
benjifisherThis is the first issue that I have fixed now that I am a maintainer.
Comment #16
wim leers🥳 — thanks @benjifisher!