Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11216

generate_text_for_display() improper auto-typecast

    XMLWordPrintable

    Details

      Description

      Function generate_text_for_display() in /includes/functions_content.php is checking too loosely on the parameter $text:

      	if (!$text)
      	{
      		return '';
      	}

      This won't give back any result if $text has the value "0", since PHP automatically tries to cast strings to integers. That's the reason why "0" == FALSE and !"0" == TRUE and the function thinks the string is empty.

      The correct code should be:

      	if ($text === '')
      	{
      		return '';
      	}

      The bug is trivial, but this function is used in many places.
      Reaction to https://www.phpbb.com/community/viewtopic.php?f=71&t=2165721&p=13201648#p13201648

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Oleg Oleg [X] (Inactive)
              Reporter:
              AmigoJack AmigoJack
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: