You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.
I was testing this library that looks really nice. I wanted to know how well it had multibyte support (UTF8 etc), and wrote some trivial code.
But I ran into a Uncaught exception 'BadMethodCallException' with message 'The method Underscore\Types\Strings::length does not exist' with version 2.0.0 (`"anahkiasen/underscore-php": "<=2.1.0" in composer.json).
I noticed with the CHANGELOG that the docs were still for version 1.x of underscore-php (String in the doc vs Strings), so I tried to use version 1.3.1, and this time it worked.
Here is the testing code I used for version 1.3.1 (it works without error):
The version 2.0.0 of the code is identical, except its Strings instead of String (At least that's what I'm assuming, if there is some documentation about updating 1.x code to 2.x code I missed it.):
<?phpuse \Underscore\Types\Strings;
// [...] <- Same as beforeechoStrings::upper('fòôbàř'); // Works fine.echoPHP_EOL;
echoStrings::length('fòôbàř'); // Exception.echoPHP_EOL;
echo'</pre>';
?>
</body>
The full error message is:
Fatal error: Uncaught exception 'BadMethodCallException' with message 'The method Underscore\Types\Strings::length does not exist' in /home/___/stacks/lampstack-5.5.29-1/apache2/htdocs/underscore.php/vendor/anahkiasen/underscore-php/src/Traits/Repository.php:183Stack trace:
#0 /home/___/stacks/lampstack-5.5.29-1/apache2/htdocs/underscore.php/index3.php(40): Underscore\Traits\Repository::__callStatic('length', Array)#1 /home/___/stacks/lampstack-5.5.29-1/apache2/htdocs/underscore.php/index3.php(40): Underscore\Types\Strings::length('f\xC3\xB2\xC3\xB4b\xC3\xA0\xC5\x99')#2 {main}
thrown in /home/___/stacks/lampstack-5.5.29-1/apache2/htdocs/underscore.php/vendor/anahkiasen/underscore-php/src/Traits/Repository.php on line 183
Did the names of the methods change in version 2.x or something ? Because it's not mentioned in the CHANGELOG.
Bitnami LAMP stack ships with the following software versions:
- Apache 2.4.16
- MySQL 5.6.26
- PHP 5.5.29
- PHPMyAdmin 4.4.13.1
- AWS SDK for PHP 1.6.2
- Varnish 3.0.5
- ImageMagick 6.7.5
- SQLite 3.7.15.1
- ModSecurity 2.6.7
- Libraries for Couchbase 2.0.5
- Couchbase PHP extension 1.1.5
- Heroku client
- Git 1.9.5
- Ruby 2.2.3
It's not a huge issue for me; I'll use a version >=1.3.0 and <2.0.0 in the meantime.
By the way, you might want to showcase a bit that underscore-php's Strings handle correctly strings like 'fòôbàř', contrary to PHP's standard strlen and such. I was trying to decide between using underscore-php's Strings or Stringy, and the latter has a nice snippet about that here, but not underscore-php. I'm throwing it here just in case the Stringy's Readme (it could be elsewhere for underscore-php) is updated and the "Why?" section is removed:
I was testing this library that looks really nice. I wanted to know how well it had multibyte support (UTF8 etc), and wrote some trivial code.
But I ran into a
Uncaught exception 'BadMethodCallException' with message 'The method Underscore\Types\Strings::length does not exist'
with version2.0.0
(`"anahkiasen/underscore-php": "<=2.1.0" in composer.json).I noticed with the CHANGELOG that the docs were still for version 1.x of underscore-php (
String
in the doc vsStrings
), so I tried to use version1.3.1
, and this time it worked.Here is the testing code I used for version
1.3.1
(it works without error):The version
2.0.0
of the code is identical, except itsStrings
instead ofString
(At least that's what I'm assuming, if there is some documentation about updating 1.x code to 2.x code I missed it.):The full error message is:
Did the names of the methods change in version 2.x or something ? Because it's not mentioned in the CHANGELOG.
Environment (Bitnami LAMP Stack 5.5.29-1 (https://bitnami.com/stacks/)):
It's not a huge issue for me; I'll use a version >=1.3.0 and <2.0.0 in the meantime.
By the way, you might want to showcase a bit that underscore-php's
Strings
handle correctly strings like'fòôbàř'
, contrary to PHP's standardstrlen
and such. I was trying to decide between using underscore-php'sStrings
or Stringy, and the latter has a nice snippet about that here, but not underscore-php. I'm throwing it here just in case the Stringy's Readme (it could be elsewhere for underscore-php) is updated and the "Why?" section is removed:But it's just a suggestion, you do what you want.
The text was updated successfully, but these errors were encountered: