|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Symfony package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Fabien Potencier <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
use Symfony\Polyfill\Iconv as p; |
|
13
|
|
|
|
|
14
|
|
|
if (!function_exists('iconv')) { |
|
15
|
|
|
define('ICONV_IMPL', 'Symfony'); |
|
16
|
|
|
define('ICONV_VERSION', '1.0'); |
|
17
|
|
|
define('ICONV_MIME_DECODE_STRICT', 1); |
|
18
|
|
|
define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2); |
|
19
|
|
|
|
|
20
|
|
|
function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); } |
|
21
|
|
|
function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); } |
|
22
|
|
|
function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); } |
|
23
|
|
|
function iconv_mime_encode($name, $value, $pref = null) { return p\Iconv::iconv_mime_encode($name, $value, $pref); } |
|
24
|
|
|
function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); } |
|
25
|
|
|
|
|
26
|
|
|
if (extension_loaded('mbstring')) { |
|
27
|
|
|
function iconv_strlen($s, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strlen($s, $enc); } |
|
28
|
|
|
function iconv_strpos($s, $needle, $offset = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strpos($s, $needle, $offset, $enc); } |
|
29
|
|
|
function iconv_strrpos($s, $needle, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strrpos($s, $needle, 0, $enc); } |
|
30
|
|
|
function iconv_substr($s, $start, $length = 2147483647, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_substr($s, $start, $length, $enc); } |
|
31
|
|
|
function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_decode_mimeheader($encodedHeaders, $mode, $enc); } |
|
|
|
|
|
|
32
|
|
|
} else { |
|
33
|
|
|
if (extension_loaded('xml')) { |
|
34
|
|
|
function iconv_strlen($s, $enc = null) { return p\Iconv::strlen1($s, $enc); } |
|
35
|
|
|
} else { |
|
36
|
|
|
function iconv_strlen($s, $enc = null) { return p\Iconv::strlen2($s, $enc); } |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function iconv_strpos($s, $needle, $offset = 0, $enc = null) { return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); } |
|
40
|
|
|
function iconv_strrpos($s, $needle, $enc = null) { return p\Iconv::iconv_strrpos($s, $needle, $enc); } |
|
41
|
|
|
function iconv_substr($s, $start, $length = 2147483647, $enc = null) { return p\Iconv::iconv_substr($s, $start, $length, $enc); } |
|
42
|
|
|
function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); } |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.