// This will cut out most of our slow time on Latin-based text,
// and 1/2 to 1/3 on East European and Asian scripts.
$bytePos = $splitPos;
- while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
+ while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
++$bytePos;
}
$charPos = mb_strlen( substr( $str, 0, $bytePos ) );
while( $charPos++ < $splitPos ) {
++$bytePos;
// Move past any tail bytes
- while ( $bytePos < $byteLen && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
+ while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
++$bytePos;
}
}
while( $bytePos > 0 && $charPos-- >= $splitPosX ) {
--$bytePos;
// Move past any tail bytes
- while ( $bytePos > 0 && $str{$bytePos} >= "\x80" && $str{$bytePos} < "\xc0" ) {
+ while ( $bytePos > 0 && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
--$bytePos;
}
}
return false;
}
}
+
+ /**
+ * Fallback implementation of stream_resolve_include_path()
+ * Native stream_resolve_include_path is available for PHP 5 >= 5.3.2
+ * @param $filename String
+ * @return String
+ */
+ public static function stream_resolve_include_path( $filename ) {
+ $pathArray = explode( PATH_SEPARATOR, get_include_path() );
+ foreach ( $pathArray as $path ) {
+ $fullFilename = $path . DIRECTORY_SEPARATOR . $filename;
+ if ( file_exists( $fullFilename ) ) {
+ return $fullFilename;
+ }
+ }
+ return false;
+ }
-}
\ No newline at end of file
+}