Page 1 of 1

Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 2:36 pm
by bcddd214
Using asterisk-1.4.21.2 on Gentoo amd_64 with astguiclient_2.2.1.zip / astguiclient_2.4rc1.zip / and the latest one.
Following the installation method in the docs/BASE_INSTALL.txt

Deprecated: Function ereg() is deprecated in /var/www/localhost/htdocs/vicidial/dbconnect.php on line 15

It chokes on if (ereg("^PATHlogs", $DBCline)) because your code is so old it's about to fall apart.
if (preg_match("/^PATHlogs/", $DBCline)) properly updates the code but that opens up a whole new nightmare of
Notice: Undefined index: PHP_AUTH_USER in /var/www/localhost/htdocs/vicidial/admin.php on line 93

I even tried switching you to pdo and that gives pretty much the same effect.
You run VoIP on code this out of date?
Hackers/voip thieves must love vicidial.
do you realize that mysql_connect() is dead for a reason?

iso install is 'not' and option

Re: Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 2:44 pm
by bcddd214
I even tried to downgrade php, same results
>=dev-lang/php-5.4.8:5.4
>=dev-lang/php-5.3.18:5.3

your code is horribly out of date. You're almost beyond duct tape repairable.

Re: Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 3:47 pm
by mflorell
What version of PHP are you using?

Re: Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 5:25 pm
by bcddd214
in the posting above.
the current stable php release is 5.4.12
I have downgraded as low as gentoo/portage will go. That's how old the vicidial code is.

Re: Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 5:57 pm
by williamconley
Is that a volunteer to replace ereg with preg or some other function throughout the system? 8-)

At PoundTeam we have Vicidial running on Ubuntu 12.04LTS and receive notices of the deprecation, but it does not "choke". Perhaps you can reduce your warning level?

We are at PHP 5.3.10-1ubuntu3.5 with Suhosin-Patch ... and Ubuntu 12.04 LTS released only a little while ago. Seems to not be a problem ... but if you want to fix that function, I'm sure it could be included in the codebase ... :)

Re: Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 7:29 pm
by mflorell
The Vicidial source code started 10 years ago, back when ereg was the ONLY built-in option for regular expressions and preg was an optional add-on that required additional software beyond perl itself to work. The NOTICE for ereg to be depricated was added years ago in PHP5 releases when the roadmap for PHP6 came out, then the PHP6 release schedule was scrapped and revised many times, but the ereg NOTICE was still left in place even though it would be years until the function was actually removed in the latest PHP stable release. ereg still works just fine in PHP5, it just throws a NOTICE, which does not impact the functionality of the script at all. I would suggest just disabling NOTICES unless you need them because you are debugging PHP on your system, they should have no effect on how Vicidial functions.

Changing the hundreds of "ereg" functions in the Vicidial PHP code to "preg" is on our development roadmap, and as we add new scripts and code we try to only use preg functions. If you would like to help with this change, we would welcome the help.

I would also like to mention that using ereg is NOT a security issue, and when security issues are found in Vicidial, we fix them quickly and issue an alert through these forums.

Re: Function ereg() is deprecated

PostPosted: Sun Feb 24, 2013 10:16 pm
by bcddd214
Thank you for your reply!
I see a few errors I made.
But I also just found a was to upload your iso to linode, so problem solved.