khaled-alshamaa / ar-php

Set of functionalities enable Arabic website developers to serve professional search, present and process Arabic content in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined offset: -1 for some strings

ahmedkheikal opened this issue · comments

I'm getting Undefined offset: -1 for some strings at ar-php/src/Arabic.php:2268 with no special cases for strings with errors

code sample

        $Arabic = new Arabic();

        $p = $Arabic->arIdentify($html);

        for ($i = count($p) - 1; $i >= 1; $i -= 2) {
            $utf8ar = $Arabic->utf8Glyphs(substr($html, $p[$i - 1], $p[$i] - $p[$i - 1]));
            $html = substr_replace($html, $utf8ar, $p[$i - 1], $p[$i] - $p[$i - 1]);
        }

Dear @ahmedkheikal, it will be more helpful if you can share with us a sample of the $html variable that reproduces this error message, so we can trace back the source of such issue and fix it.

I believe this commit dealt with your reported issue and will be available in the next release v6.1