Issue Bug Closed

#38969PHP Warning: str_pad() expects parameter 2 to be long, string given

Peter Linzenkirchner 07/15/12, 23:13 updated 10/02/18, 12:17

Description

Core: Error handler (FE): PHP Warning: str_pad() expects parameter 2 to be long, string given in /Users/peter/Sites/typo3_src-4.5.17/typo3/sysext/cms/tslib/class.tslib_content.php line 3588

only php 5.3.

PHP: string str_pad ( string $input , int $pad_length ….) 2. option should be a integer.

function prefixComment($str, $conf, $content) {
$parts = explode(‘|’, $str);
$output = LF . str_pad(‘’, $parts0, TAB) . …..
…
}

$parts[0] is interpreted as string. when i add a type cast the warning disappears:

$output = LF . str_pad(‘’, (int)$parts0, TAB) . …..

Reviews 2