Bug #38969
closedPHP Warning: str_pad() expects parameter 2 to be long, string given
100%
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('', $parts[0], TAB) . .....
...
}
$parts[0]
is interpreted as string. when i add a type cast the warning disappears:
$output = LF . str_pad('', (int)$parts[0], TAB) . .....
Updated by Philipp Gampe over 12 years ago
Do you mind pushing a patch go gerrit?
http://wiki.typo3.org/Contribution_Walkthrough_Tutorials
Updated by Ernesto Baschny over 12 years ago
- Status changed from New to Needs Feedback
The problem is not the PHP code, but that you somewhere have a Typoscript snippet which does not conform to the documentation:
"Prefixes content with an HTML comment with the second part of input string (divided by "|") where first part is an integer telling how many trailing tabs to put before the comment on a new line."
So you probably have something like that in your Typoscript:
prefixComment = string
When it should be (for example):
prefixComment = 1 | string
I cannot find any wrong use in the TYPO3 Core, so it might be either an extension or your own Typoscript.
This being said, the prefixComment (in future) could of course "fall back" to "0 tabs" if there is no "|" divider. But this would be a new feature (for 6.0 if you want to contribute).
Updated by Peter Linzenkirchner over 12 years ago
Hi Ernesto,
you are right ... :-( i found this line in the typoscript:
tt_content.stdWrap.prefixComment =
after commenting out the problem is gone ...
I am very sorry for the noise and for causing unnecessary work!!
Updated by Philipp Gampe over 12 years ago
No problem.
@Ernesto please leave this open ... I would like to improve the error detection an graceful fallback once done with my tests (read next week)
Updated by Ernesto Baschny over 12 years ago
- Status changed from Needs Feedback to Accepted
@Philipp, fine with me! Better handling (i.e. TS message in the admin panel) would be of course much better than "PHP warnings", if the behaviour (in the frontend) doesn't change. We could even backport that to 4.5 as a BUGFIX.
Updated by Mathias Schreiber almost 10 years ago
- Status changed from Accepted to Needs Feedback
- Assignee set to Mathias Schreiber
- Is Regression set to No
Hey Philipp,
next week is fine... which timezone? ;-)
Updated by Gerrit Code Review almost 10 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35973
Updated by Philipp Gampe almost 10 years ago
- Assignee changed from Mathias Schreiber to Philipp Gampe
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35973
Updated by Gerrit Code Review almost 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35973
Updated by Gerrit Code Review almost 10 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35977
Updated by Philipp Gampe almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6128285a83c31f9cbce940eeda9cd868ad0c09da.