PHP 7.3
joshuabaker opened this issue · comments
Hey Andrew,
Getting an unexpected output using PHP 7.3. I suspect this is an issue with an underlying library.
Template
{{ 'Adipiscing Vehicula Ridiculus Pharetra'|typogrify }}
PHP 7.2 Output
Adipiscing Vehicula Ridiculus Pharetra
PHP 7.3 Output
A d i p i s c i n g V e h i c u l a R i d i c u l u s P h a r e t r a
So this is going to be an issue with the underlying library, perhaps file an issue here ->
I’ve just tested that library in isolation (same local server) without encountering the issue on PHP 7.3.
<?php
require_once '../vendor/autoload.php';
$settings = new \PHP_Typography\Settings();
$settings->set_hyphenation(false);
$settings->set_max_dewidow_length(10);
$settings->set_max_dewidow_pull(10);
$typography = new \PHP_Typography\PHP_Typography();
echo $typography->process('Adipiscing Vehicula Ridiculus Pharetra', $settings);
Is there anything happening under the hood that might cause this?
hmmm the only differences I can think of is that here:
https://github.com/nystudio107/craft-typogrify/blob/v1/src/variables/TypogrifyVariable.php#L42
I do:
Typogrify::$plugin->typogrify->typogrify($text, $isTitle);
Rather than ->process
Also check the versions of the lib you're using directly vs. the version of the lib that Typogrify uses?
Thanks for reopening.
I’ve just checked in and the PHP Typography call is here: TypogrifyService.php#L89
$result = $this->phpTypography->process($text, $this->phpTypographySettings, $isTitle);
Ah yes, sorry.
Yeah I can't think of anything I could be doing other than the Template::raw()
which would then render raw if there were any HTML entities returned.
Also the fact that it works fine on all versions of PHP up to 7.3 have me thinking it could be a bit more involved.
Just to confirm, my test is using the same vendor directory.
Also, the Template::raw()
call isn’t to blame here.
echo Typogrify::$plugin->typogrify->typogrify('Adipiscing Vehicula Ridiculus Pharetra', false);
// Output: A d i p i s c i n g V e h i c u l a R i d i c u l u s P h a r e t r a
Andrew, sorry, I need to retract my earlier comment. The issue is with the underlying library.
If having an open issue isn’t bothersome for you, please can we leave this open for now.
You got it.
@khalwat , have you been able to reproduce this issue? All the tests run fine on Travis with PHP 7.3.
@khalwat Is this happening for you too?
I'm not using PHP 7.3, so I haven't tried reproducing it yet; but I have heard of other people switching to PHP 7.3 and running into exactly this issue with both my plugin, and also the Wordsmith plugin (which both rely on your awesome library @mundschenk-at ).
Thanks, Andrew. 👍
I think there’s something happening along the way in Craft/Yii that’s impacting how that library works.
Looks like a Craft CMS issue, fixed in craftcms/cms@8bf818a