Skip to content
This repository has been archived by the owner. It is now read-only.

*PHP 5.3.8 Notice for some language packs with iconv. #727

Merged
merged 4 commits into from Mar 3, 2012

Conversation

Projects
None yet
6 participants
@infograf768
Copy link
Member

commented Jan 9, 2012

Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\j173\libraries\joomla\utilities\string.php on line 562 (error shown on 1.7.3, same on 2.5 beta)

Looks like an issue specific to that version of PHP. Tested with Cambodian language pack. I see no other solution atm than preventing the Notice display.

PHP 5.3.8 Notice for some language packs with iconv.
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\j173\libraries\joomla\utilities\string.php on line 562 (error shown on 1.7.3, same on 2.5 beta)
@joomla-jenkins

This comment has been minimized.

Copy link

commented Jan 9, 2012

Unit testing complete. There were 0 failures and 0 errors from 1971 tests and 11146 assertions.
Checkstyle analysis reported 199 warnings and 0 errors.

@ianmacl

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2012

There are known performance issues with using @ which aren't due to be fixed until 5.4. Have you tried using //IGNORE as suggested in the documentation? (http://php.net/manual/en/function.iconv.php).

@realityking

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2012

any way to know what characters cause these issues? can we filter them out before?

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Jan 9, 2012

I can send you the pack. It looks like Fabrik had the same issue with Farsi and just prevented the Notice display as proposed here.
Will ask the TT what gives adding //IGNORE

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Jan 10, 2012

Proposed to change the code to
return iconv($from_encoding, $to_encoding . '//TRANSLIT//IGNORE', $source);
as posted in http://php.net/manual/en/function.iconv.php

Same issue:
debug (on last instance of trunk)
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\j25b\libraries\joomla\string\string.php on line 730
Call Stack

Time Memory Function Location

1 0.0024 384160 {main}( ) ..\index.php:0
2 0.5212 8810360 JAdministrator->render( ) ..\index.php:53
3 0.5375 8993136 JDocumentHTML->render( ) ..\application.php:202
4 0.5375 8993136 JDocumentHTML->_renderTemplate( ) ..\html.php:433
5 0.6338 9989024 JDocumentHTML->getBuffer( ) ..\html.php:655
6 0.6338 9989400 JDocumentRendererModules->render( ) ..\html.php:371
7 0.6339 9989992 JDocumentRendererModule->render( ) ..\modules.php:39
8 0.6340 9990968 JModuleHelper::renderModule( ) ..\module.php:106
9 0.6433 10056568 include( 'D:\wamp\www\j25b\administrator\modules\mod_menu\mod_menu.php' ) ..\helper.php:175
10 0.6521 10245544 require( 'D:\wamp\www\j25b\administrator\modules\mod_menu\tmpl\default.php' ) ..\mod_menu.php:29
11 0.6615 10429416 require( 'D:\wamp\www\j25b\administrator\modules\mod_menu\tmpl\default_enabled.php' ) ..\default.php:13
12 0.6823 10485456 ModMenuHelper::getComponents( ) ..\default_enabled.php:272
13 0.7316 10533192 JArrayHelper::sortObjects( ) ..\helper.php:124
14 0.7316 10534224 usort ( ) ..\arrayhelper.php:463
15 0.7316 10534264 JArrayHelper::_sortObjects( ) ..\arrayhelper.php:463
16 0.7317 10534328 JString::strcmp( ) ..\arrayhelper.php:514
17 0.7355 10534880 JString::transcode( ) ..\string.php:425
18 0.7355 10534976 iconv ( ) ..\string.php:730

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Jan 10, 2012

The TT tested with both

return iconv($from_encoding, $to_encoding . '//IGNORE//TRANSLIT', $source);

and

return iconv($from_encoding, $to_encoding . '//IGNORE', $source);

and in these cases, he did not find any error and all characters displayed OK

Which one do you suggest we use?
I would be in favour of
return iconv($from_encoding, $to_encoding . '//IGNORE//TRANSLIT', $source);

@realityking

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2012

Does this actually work
return iconv($from_encoding, $to_encoding . '//IGNORE//TRANSLIT', $source);

Or is the //TRANSLIT part ignored by PHP?

@joomla-jenkins

This comment has been minimized.

Copy link

commented Jan 10, 2012

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 1 errors from 1971 tests and 11145 assertions.
Checkstyle analysis reported 199 warnings and 0 errors.

@elinw

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2012

We have an issue in Finder with invalid UTF 8 which Chris fixed with $input = iconv("UTF-8","UTF-8//IGNORE",$input);.

Seemed to work well. I think the issue might be related to debug as well.

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Feb 21, 2012

Changed to //IGNORE

@joomla-jenkins

This comment has been minimized.

Copy link

commented Feb 21, 2012

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 1 errors from 2067 tests and 11357 assertions.
Checkstyle analysis reported 164 warnings and 0 errors.

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Feb 21, 2012

Now that IGNORE is used, are the tests at stake?

@chdemko

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2012

@infograf768 The tests are still failing: it is due to an error in php https://bugs.php.net/bug.php?id=48147. In fact it depends on the library used for the iconv function. Some use

  • libiconv (windows system)
  • glibc (linux/unix system)
  • ...

This code (replace the transcode method) pass the unit test:
https://gist.github.com/1877210

Could you ask TT to test it ?

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Feb 21, 2012

Asking now

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Feb 22, 2012

Results are positive. No more errors.
How do we proceed now?

@chdemko

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2012

@infograf768 Just update your remote patch-4 branch on github

@joomla-jenkins

This comment has been minimized.

Copy link

commented Feb 22, 2012

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 2170 tests and 11524 assertions.
Checkstyle analysis reported 163 warnings and 0 errors.

@infograf768

This comment has been minimized.

Copy link
Member Author

commented Feb 23, 2012

Opening tracker in CMS with patch.

chdemko added a commit that referenced this pull request Mar 3, 2012

Merge pull request #727 from infograf768/patch-3
*PHP 5.3.8 Notice for some language packs with iconv.

@chdemko chdemko merged commit af0a9d3 into joomla:staging Mar 3, 2012

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.