Skip to content

linkify strips consecutive line breaks #305

Open
@dariusj18

Description

@dariusj18

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:

  1. Retrieve a tweet with consecutive line breaks ex. \n\n
  2. Run Twitter::linkify($tweet)
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions