Home > amfphp | php > AMFPHP Browser issue: Function eregi_replace() is deprecated

AMFPHP Browser issue: Function eregi_replace() is deprecated

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

POSTED ON October 23, 2009, ,

Comments:11

Leave my own
  1. Alaa Muhammad Reply
    09/10/31

    Many Thanks!

  2. PH Reply
    09/11/13

    FĂ©licitation … super utile! Merci
    Congratulation, very usefull. Thanks

  3. kazarus Reply
    09/11/22

    Thanks your help

  4. BartekB Reply
    09/12/02

    Thanks, very helpfull post

  5. Jacks Reply
    10/01/22

    hey pal thanks for that, nice stuff.

  6. Matt Reply
    10/02/05

    You the man. Exactly what I needed, thanks for posting.

  7. payday loans Reply
    10/02/21

    I want to thank the blogger very much not only for this post but also for his all previous efforts. I found http://www.aschile.net to be greatly interesting. I will be coming back to http://www.aschile.net for more information.

  8. nuwud Reply
    10/03/07

    That was awesome and saved me hours of hair -pulling! Nice! Many thanks!

  9. Gaurav Reply
    10/04/14

    Hi All,

    I am using AMFPHP 1.9,PHP 5.26 , Apache 2.049 , MySQL 5.1.51.

    When i try to access my services on the browser and click on the service class then it gives me the following message:

    “Error retrieving service info:

    Invalid AMF message”

    I get only this above message and i checked my php_error log file but there is no error.

    Please help to resolve this issue.

    Any help or suggestions would be greatly appriciated.

  10. XpertXP Reply
    10/04/16

    I really like when people are expressing their opinion and thought. So I like the way you are writing

  11. Sérgio Ricardo Reply
    10/06/10

    OK,

    Funcionou muito bem.
    Obrigado.

Leave a Reply

Trackbacks:1

Listed below are links to weblogs that reference
AMFPHP Browser issue: Function eregi_replace() is deprecated from Renato Moya
pingback from AMFPHP issue Function eregi_replace() is deprecated error « Ismejks's Blog January 22, 2010

[...] eregi_replace() is deprecated error, now thanks to Renato Moya who adressed the problem on his blog the problem can now be fix by just replacing: the file in [...]

TOP