23Oct

AMFPHP Browser issue: Function eregi_replace() is deprecated

FILED IN amfphp | php 12 Comments

Have anyone had this problem? When you try using amfphp 1.9 beta browser to test your methods, you get an error like this:

Error retrieving service info:
Function eregi_replace() is deprecated
C:\${Your_address}\amfphp\core\shared\util\MethodTable.php on line 513

Well, the thing is since amfphp has practically no support anymore, since a newer version hasn’t been released in.. months? years? Who knows..

I googled a bit and I found the solution on a french forum. Looks like amfphp is throws this error because since I am using php5 on my server, the MethodTable script is using a deprecated function which needs to be updated in order to be functional again.

All you have to do to is go to: /amfphp/core/shared/utils and open the script MethodTable.php

Find the line 505, if you’re using Notepad++ which I recommend developers to use since it is pretty handy and lightweight, just use the shortcut Ctrl + G, type in the line number and there you go.

Now, you need to replace these three lines:

$comment = eregi_replace(“\n[ \t]+”, “\n”, trim($comment));
$comment = str_replace(“\n”, “\\n”, trim($comment));
$comment = eregi_replace(“[\t ]+”, ” “, trim($comment));

By these

$comment = preg_replace(“`\n[ \t]+`U”, “\n”,trim($comment));
$comment = str_replace(“\n”, “\\n”, trim($comment));
$comment = preg_replace(“`[\t ]+`U”, ” “,trim($comment));

And problem solved.

As you see, eregi_replace() is the php function that was giving us troubles, and if you check the php documentation the first thing you’ll see is a big warning sign telling you that this function is deprecated.

If anyone understand french, you can check the forum post where I find the solution: here

,

TOP