twitter
twitter copied to clipboard
linkify strips consecutive line breaks
Describe the bug
Twitter::linkify() has the line $text = preg_replace('/\s+/', ' ', $text);. This strips out consecutive line breaks. I'm not sure why the linkify tries to remove extra spaces, but at the least it should probably limit it to space (ascii 32) characters.
To Reproduce Steps to reproduce the behavior:
- Retrieve a tweet with consecutive line breaks ex. \n\n
- Run Twitter::linkify($tweet)
- See that it strips the line breaks out, preventing using
nl2br()to show the tweet as written.
Expected behavior Leave line breaks in the returned string.
Version 2.2.11
Additional context
This may be because the tweet is retrieved via "tweet_mode = extended", perhaps the linkify could contextually strip out spaces or not if the tweet has the text property vs. the full_text property.
Feel free to PR a fix to the regex :)