Project

General

Profile

Actions

Bug #15795

closed

Some notices and warnings in class.t3lib_cs.php (2 things)

Added by Eloy Lafuente over 18 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2006-03-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

1.- Notices: Using the specCharsToASCII() function, we have detected that the initUnicodeData() function has lines like this:

if (is_array($this->caseFolding['utf-8'])) return 1;

And they throw some notices. To avoid them we have used something like:

if (!empty($this->caseFolding['utf-8']) && is_array($this->caseFolding['utf-8']))

Trivial hack.

2.-Warnings: More strange (under our opinion) is that type of loop (found more than once):

for($i=0; strlen($str{$i}); $i++) {

that throws one warning always (we think). Shouldn't it better to change it to something like:

for($i=0; $i < strlen($str); $i++) {

(we haven't been able to find any reason for your loop syntax)

Not critical at all, you know! ;-)
(issue imported from #M2814)


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #22398: Nagging error notices in class.t3lib_div.php / $_SERVER assumptions.Closed2010-04-07

Actions
Related to TYPO3 Core - Bug #15025: PHP NoticesClosedChris topher2005-10-11

Actions
Actions #1

Updated by Martin Kutschker over 18 years ago

What kind of notices appear in case 1.?

As for 2.: The idea is to avoid a strlen call on the complete string.

Actions #2

Updated by Eloy Lafuente over 18 years ago

1 returns: Notice: Undefined index: utf-8 in /srv/www/htdocs/moodle/head/lib/typo3/class.t3lib_cs.php on line 1008

2 returns: Notice: Uninitialized string offset: 4 in /srv/www/htdocs/moodle/head/lib/typo3/class.t3lib_cs.php on line 1843

I can see that executing strlen($str) for each loop iteration it too much but it also could be calculated once before the for loop, avoiding the notice.

We are using your library in Moodle from one wrapper library and, for now, we are switching the error reporting level before using specCharsToASCII(), so it isn't a real problem but, as a common habit we prefer not to play with the error level here and there but to see everything always displayed instead ;-)

Actions #3

Updated by Clemens Riccabona over 15 years ago

I can confirm this behaviour on a fresh and clean 4.2.6.
With php 5.2.6 on a linux.

New line information:

1. PHP Notice Line 1046
2. PHP Notice Line 1881

Seems that this hasn't been fixed until now. ;)

Actions #4

Updated by Chris topher over 14 years ago

Seeing the outcome of the discussion in #15025 I think we don't fix the notice.

A warning should be fixed - but it seems like there also only is a notice in case 2.

Actions

Also available in: Atom PDF