jfcherng / php-mb-string Goto Github PK
View Code? Open in Web Editor NEWAn implementation targeting high performance for frequently reading/writing operations for multi-byte string.
License: MIT License
An implementation targeting high performance for frequently reading/writing operations for multi-byte string.
License: MIT License
Hi!
I've been building a CMS versioning system using your excellent php-diff
library which of course has php-mb-string
as a dependency.
It turns out that it works on some server environments, and not others due to it's usage of iconv
to convert encoding to UTF-32.
https://github.com/jfcherng/php-mb-string/blob/master/src/MbString.php#L361
e.g. locally \iconv('UTF-8', 'UTF-32', 'This is a string.')
outputs the expected string. However, on some hosting providers this returns false
.
In a perfect world we could control the server environments it gets installed on, but often it's not the case. 😅
Is there any chance of switching to something like mb_convert_encoding
instead of iconv
?
Fatal error: Uncaught TypeError: substr() expects parameter 1 to be string, bool given in /srv/src/vendor/jfcherng/php-mb-string/src/MbString.php:340
Stack trace:
#0 /srv/src/vendor/jfcherng/php-mb-string/src/MbString.php(340): substr(false, 4)
#1 /srv/src/vendor/jfcherng/php-mb-string/src/MbString.php(71): Jfcherng\Utility\MbString->inputConv('\t\t\tvar re = '',...')
#2 /srv/src/vendor/jfcherng/php-diff/src/Renderer/Html/AbstractHtml.php(153): Jfcherng\Utility\MbString->set('\t\t\tvar re = '',...')
#3 /srv/src/vendor/jfcherng/php-diff/src/Renderer/Html/AbstractHtml.php(89): Jfcherng\Diff\Renderer\Html\AbstractHtml->renderChangedExtent(Object(Jfcherng\Diff\Renderer\Html\LineRenderer\Char), '\t\t\tvar re = '',...', '\t\t\tvar re = '',...')
#4 /srv/src/vendor/jfcherng/php-diff/src/Renderer/Html/AbstractHtml.php(113): Jfcherng\Diff\Renderer\Html\AbstractHtml->getChanges(Object(Jfcherng\Diff\Differ))
#5 /srv/src/vendor/jfcherng/php-diff/src/Renderer/AbstractRenderer.php(172): Jfcherng\Diff\Renderer\Html\AbstractHtml->renderWo in /srv/src/vendor/jfcherng/php-mb-string/src/MbString.php on line 340
iconv() can return a string or false.
I am guessing this string is what is breaking it but that's a different issue '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.