Request - Revamp the agi-bin scripts for PHP 5.3

In troubleshooting why I could not call my internal phones after installing MacOSX 10.6, asterisk- I came across the a problem where possibly the goto function in phpagi.php conflicts with the built-in goto function of PHP-5.3. I fixed the problem by downgrading the PHP and manually forcing the script to use that php instead.

can you point out exactly what the error is?

Are you saying that defining a “goto” method inside the AGI class is making 5.3 fail?

ok, I was having a problem where dailparties would always return:

[Sep 14 10:59:19] VERBOSE[109] logger.c: – AGI Script dialparties.agi completed, returning 0
[Sep 14 10:59:19] DEBUG[109] app_macro.c: Executed application: AGI
[Sep 14 10:59:19] VERBOSE[109] logger.c: – Executing [[email protected]:4] NoOp(“SIP/spa3000-00827800”, "Returned from dialparties with no extensions to call and DIALSTATUS: ") in new stack

Then I started wondering about dialparties and posted about it to the forum. After which I started examining the /var/lib/asterisk/agi-bin (well, I used /opt/local as my prefix here) scripts and attempted to run enumlookup.agi which returned an error:

Parse error: syntax error, unexpected T_GOTO, expecting T_STRING in /opt/local/var/lib/asterisk/agi-bin/phpagi.php on line 1233

I scowered the net and found a bug on sourceforge filed by someone concerning the goto function in phpagi.php:

Oh, so - I grabbed MacPorts and installed php-5.2.10 and manually set the php path in all the scripts in /var/lib/asterisk/agi-bin from pointing to /usr/bin/php (which is version 5.3.0) to /opt/local/bin/php (which is 5.2.10) and everything began working.

sh-3.2# /usr/bin/php -version
PHP 5.3.0 (cli) (built: Jul 19 2009 00:34:30)
Copyright © 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2009 Zend Technologies
sh-3.2# /opt/local/bin/php -version
PHP 5.2.10 (cli) (built: Sep 17 2009 21:15:16)
Copyright © 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright © 1998-2009 Zend Technologies

sh-3.2# uname -a
Darwin 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 PDT 2009; root:xnu-1456.1.25~1/RELEASE_I386 i386

I guess what I was attempting to do with this thread is try and get (I guess phpagi.php) updated/fixed. I would guess all the problems would be addressed if the core function was fixed. Not sure who owns that on Sourceforge - but it sure looks mighty dormant since it has not been touched in some time…


Otherwise, all is good here - no other complaints :smiley:

phpagi is not being maintained sourceforge and we have reasonably significant changes since then.

I am still not sure what the issue is that has changed in 5.3 that is causing this and don’t currently have a system with 5.3 to evaluate that.

So I am back to my question, in case someone knows the answer. Does 5.3 restrict the definition of a class method from being named the same thing as a built in function, or is this particular to goto function only? Changing the name of the method is not a reasonable option as it would break existing AGI scripts that use it.

hmm …

ok I see the issue by trying to make a method called ‘while’ on a php4 system, it does not like that :frowning:

well please file a bug on the issue so we can keep the awareness while deciding how to handle this.

I resolve “unexpected T_GOTO, expecting T_STRING” problem with php 5.3 & Zend Framework. I replace Old old Zend/Controller/Action/Helper/Redirector.php on final, and all working now.