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

"String offset cast occured" error on PHP 5.4

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0.11
    • Fix Version/s: 3.0.12-RC1
    • Component/s: None
    • Labels:
      None
    • Environment:
      PHP 5.4.10 (cli) (built: Dec 25 2012 01:29:21)

      Description

      [phpBB Debug] PHP Notice: in file [ROOT]/includes/captcha/captcha_non_gd.php on line 123: String offset cast occurred

      Lots of those.

      http://mark-story.com/posts/view/new-errors-in-php-5-4

        Activity

        Hide
        rxu Ruslan Uzdenov added a comment -

        Similar thing exists on develop-olympus too, see https://www.phpbb.com/community/viewtopic.php?f=46&t=2155882
        As floor() returns float, we should cast the result as int.
        I'm not sure if a different ticket is needed or the current one just to be edited

        Show
        rxu Ruslan Uzdenov added a comment - Similar thing exists on develop-olympus too, see https://www.phpbb.com/community/viewtopic.php?f=46&t=2155882 As floor() returns float, we should cast the result as int. I'm not sure if a different ticket is needed or the current one just to be edited
        Hide
        Oleg Oleg [X] (Inactive) added a comment -

        Ticket should be moved to olympus but I dislike the new jira too much to bring myself to do it right now.

        Show
        Oleg Oleg [X] (Inactive) added a comment - Ticket should be moved to olympus but I dislike the new jira too much to bring myself to do it right now.
        Hide
        bantu Andreas Fischer added a comment -

        The PHP error message could have been worded better. I assume "String offset cast" means it's casted to integer.

        Show
        bantu Andreas Fischer added a comment - The PHP error message could have been worded better. I assume "String offset cast" means it's casted to integer.
        Hide
        bantu Andreas Fischer added a comment -

        afischer@leonard:/var/www/projects/phpbb3 (develop-olympus) phpBB $ grep "floor(" . -Ri | grep -v "\~"
        ./viewtopic.php:	$start = floor(($topic_data['prev_posts']) / $config['posts_per_page']) * $config['posts_per_page'];
        ./viewtopic.php:	$start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
        ./viewtopic.php:	$last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false;
        ./search.php:				$start = floor(($total_match_count - 1) / $per_page) * $per_page;
        ./includes/search/fulltext_native.php:				WHERE word_count > ' . floor($config['num_posts'] * $common_threshold) . '
        ./includes/captcha/captcha_gd.php:		$hi = floor($hsv[0] / 60);
        ./includes/captcha/captcha_non_gd.php:		for ($i = floor($width/2); $i < $end; $i++)
        ./includes/captcha/plugins/captcha_abstract.php:		$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
        ./includes/captcha/plugins/captcha_abstract.php:		$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
        ./includes/captcha/plugins/captcha_abstract.php:		$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
        ./includes/captcha/plugins/captcha_abstract.php:		$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
        ./includes/mcp/mcp_topic.php:		$start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
        ./includes/session.php:			return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
        ./includes/functions.php:	$on_page = floor($start_item / $per_page) + 1;
        ./includes/functions.php:	$on_page = floor($start / $per_page) + 1;
        ./includes/db/mssql_odbc.php:				$max_size = floor($max_size / 1024);
        ./includes/db/mssql_odbc.php:				$max_size = floor((int) ($max_size . $unit) / 1048576);
        ./includes/functions_user.php:			$image_data[1] = (int) floor(($current_x / $image_data[0]) * $image_data[1]);
        ./includes/functions_user.php:			$image_data[0] = (int) floor(($current_y / $image_data[1]) * $image_data[0]);
        ./viewforum.php:	$start = ($start < 0) ? 0 : floor(($topics_count - 1) / $config['topics_per_page']) * $config['topics_per_page'];
        ./install/index.php:		$mem_limit = floor($mem_limit / 1024);
        ./install/index.php:		$mem_limit = floor((int) ($mem_limit . $unit) / 1048576);
        ./install/install_convert.php://				$percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows));
        ./install/install_convert.php:						$percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement));

        Show
        bantu Andreas Fischer added a comment - afischer@leonard:/var/www/projects/phpbb3 (develop-olympus) phpBB $ grep "floor(" . -Ri | grep -v "\~" ./viewtopic.php: $start = floor(($topic_data['prev_posts']) / $config['posts_per_page']) * $config['posts_per_page']; ./viewtopic.php: $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page']; ./viewtopic.php: $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false; ./search.php: $start = floor(($total_match_count - 1) / $per_page) * $per_page; ./includes/search/fulltext_native.php: WHERE word_count > ' . floor($config['num_posts'] * $common_threshold) . ' ./includes/captcha/captcha_gd.php: $hi = floor($hsv[0] / 60); ./includes/captcha/captcha_non_gd.php: for ($i = floor($width/2); $i < $end; $i++) ./includes/captcha/plugins/captcha_abstract.php: $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); ./includes/captcha/plugins/captcha_abstract.php: $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); ./includes/captcha/plugins/captcha_abstract.php: $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); ./includes/captcha/plugins/captcha_abstract.php: $this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff); ./includes/mcp/mcp_topic.php: $start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page; ./includes/session.php: return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60))); ./includes/functions.php: $on_page = floor($start_item / $per_page) + 1; ./includes/functions.php: $on_page = floor($start / $per_page) + 1; ./includes/db/mssql_odbc.php: $max_size = floor($max_size / 1024); ./includes/db/mssql_odbc.php: $max_size = floor((int) ($max_size . $unit) / 1048576); ./includes/functions_user.php: $image_data[1] = (int) floor(($current_x / $image_data[0]) * $image_data[1]); ./includes/functions_user.php: $image_data[0] = (int) floor(($current_y / $image_data[1]) * $image_data[0]); ./viewforum.php: $start = ($start < 0) ? 0 : floor(($topics_count - 1) / $config['topics_per_page']) * $config['topics_per_page']; ./install/index.php: $mem_limit = floor($mem_limit / 1024); ./install/index.php: $mem_limit = floor((int) ($mem_limit . $unit) / 1048576); ./install/install_convert.php:// $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows)); ./install/install_convert.php: $percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement));
        Hide
        bantu Andreas Fischer added a comment - - edited

        I used

        grep '\$[[:alnum:]]*\[\$'. -Ri | grep -v "\~" | grep -v "^vendor/" | grep -v "^develop/" | less

        to go through possible string offset accesses, but most of the results are array accesses.

        Show
        bantu Andreas Fischer added a comment - - edited I used grep '\$[[:alnum:]]*\[\$'. -Ri | grep -v "\~" | grep -v "^vendor/" | grep -v "^develop/" | less to go through possible string offset accesses, but most of the results are array accesses.

          People

          • Assignee:
            bantu Andreas Fischer
            Reporter:
            Oleg Oleg [X] (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development