mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-31 04:34:27 +00:00
Merge pull request #518 from zachborboa/master
Require mbstring extension to use library
This commit is contained in:
+2
-1
@@ -14,7 +14,8 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"ext-curl": "*"
|
||||
"ext-curl": "*",
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "*",
|
||||
|
||||
@@ -15,6 +15,6 @@ class StrUtil
|
||||
*/
|
||||
public static function startsWith($haystack, $needle)
|
||||
{
|
||||
return mb_substr($haystack, 0, mb_strlen($needle)) === $needle;
|
||||
return \mb_substr($haystack, 0, \mb_strlen($needle)) === $needle;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -56,10 +56,10 @@ class Url
|
||||
// buffer; otherwise,
|
||||
} elseif (StrUtil::startsWith($input, '/../')) {
|
||||
$input = substr($input, 3);
|
||||
$output = substr_replace($output, '', mb_strrpos($output, '/'));
|
||||
$output = substr_replace($output, '', \mb_strrpos($output, '/'));
|
||||
} elseif ($input === '/..') {
|
||||
$input = '/';
|
||||
$output = substr_replace($output, '', mb_strrpos($output, '/'));
|
||||
$output = substr_replace($output, '', \mb_strrpos($output, '/'));
|
||||
|
||||
// D. if the input buffer consists only of "." or "..", then remove
|
||||
// that from the input buffer; otherwise,
|
||||
@@ -70,7 +70,7 @@ class Url
|
||||
// the output buffer, including the initial "/" character (if
|
||||
// any) and any subsequent characters up to, but not including,
|
||||
// the next "/" character or the end of the input buffer.
|
||||
} elseif (!(($pos = mb_strpos($input, '/', 1)) === false)) {
|
||||
} elseif (!(($pos = \mb_strpos($input, '/', 1)) === false)) {
|
||||
$output .= substr($input, 0, $pos);
|
||||
$input = substr_replace($input, '', 0, $pos);
|
||||
} else {
|
||||
@@ -131,7 +131,7 @@ class Url
|
||||
if (StrUtil::startsWith($r['path'], '/')) {
|
||||
$target['path'] = self::removeDotSegments($r['path']);
|
||||
} else {
|
||||
$base = mb_strrchr($b['path'], '/', true);
|
||||
$base = \mb_strrchr($b['path'], '/', true);
|
||||
if ($base === false) {
|
||||
$base = '';
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ class CurlTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$this->assertTrue(extension_loaded('curl'));
|
||||
$this->assertTrue(extension_loaded('gd'));
|
||||
$this->assertTrue(extension_loaded('mbstring'));
|
||||
}
|
||||
|
||||
public function testArrayAssociative()
|
||||
|
||||
Reference in New Issue
Block a user