We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 31cc1af + 406933c commit f5066a5Copy full SHA for f5066a5
src/Html2Text.php
@@ -352,7 +352,11 @@ protected function doConvert()
352
{
353
$this->linkList = array();
354
355
- $text = trim($this->html ?? '');
+ if ($this->html === null) {
356
+ $text = '';
357
+ } else {
358
+ $text = trim($this->html);
359
+ }
360
361
$this->converter($text);
362
@@ -390,7 +394,10 @@ protected function converter(&$text)
390
394
$text = preg_replace("/[\n]{3,}/", "\n\n", $text);
391
395
392
396
// remove leading empty lines (can be produced by eg. P tag on the beginning)
393
- $text = ltrim($text ?? '', "\n");
397
+ if ($text === null) {
398
399
400
+ $text = ltrim($text, "\n");
401
402
if ($this->options['width'] > 0) {
403
$text = wordwrap($text, $this->options['width']);
0 commit comments