Project

General

Profile

Actions

Bug #38969

closed

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

Added by Peter Linzenkirchner over 12 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Frontend
Target version:
-
Start date:
2012-07-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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) . .....
Actions #1

Updated by Philipp Gampe over 12 years ago

Do you mind pushing a patch go gerrit?
http://wiki.typo3.org/Contribution_Walkthrough_Tutorials

Actions #2

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).

Actions #3

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!!

Actions #4

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)

Actions #5

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.

Actions #6

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? ;-)

Actions #7

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

Actions #8

Updated by Philipp Gampe almost 10 years ago

  • Assignee changed from Mathias Schreiber to Philipp Gampe
Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Philipp Gampe almost 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF