Web lists-archives.com

[PHP] Fixing new problems due to deprecations ...




preg_replace /e deprecated so I put the fix I had in ...

> - 'sort'=>preg_replace('/([0-9]+)/e', 'substr("000000000\\1", -10)', $value)
> + 'sort'=>preg_replace_callback('/([0-9]+)/',  function ($match) { return substr("000000000$match", -10); }, $value)

ERROR 8: Array to string conversion
0 Error occurred on line 440 of file class_gedcomrecord.php in function
{closure}
1 called from in function preg_replace_callback

It's buried several thousand lines into an import routine but it's not
the first time I've been hit by the match returning an array rather than
a single entry. Can someone point me to the 'modern' way to handle this
rather than just switching off the deprecated warnings :)

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php