Bug #214
clean up code
| Status: | Closed | Start: | 10/21/2009 | |
|---|---|---|---|---|
| Priority: | Urgent | Due date: | 10/23/2009 | |
| Assigned to: | patrick_elx | % Done: | 100% |
|
| Category: | - | |||
| Target version: | Caller ID Superfecta v 2.2.2 Maintenance Release |
Description
callerid is still returning a lot of warning in the error log. Not a big deal as it's still working properly, but maybe a cleanup is needed.
The following is the error log for one lookup.
1 [error]PHP Notice: Undefined index: scheme in callerid.php on line 20
2 [error]PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 689
3 [error] PHP Warning: Invalid argument supplied for foreach() in callerid.php on line 692
4 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 714
5 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 689
6 [error] PHP Warning: Invalid argument supplied for foreach() in callerid.php on line 692
7 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 714
8 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 689
9 [error] PHP Warning: Invalid argument supplied for foreach() in callerid.php on line 692
10 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 714
11 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 689
12 [error] PHP Warning: Invalid argument supplied for foreach() in callerid.php on line 692
13 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 714
14 [error] PHP Notice: Undefined variable: first_caller_id in callerid.php on line 275
15 [error] PHP Warning: split() [<a href='function.split'>function.split</a>]: REG_BADRPT in callerid.php on line 689
16 [error] PHP Warning: Invalid argument supplied for foreach() in callerid.php on line 692
17 [error] PHP Notice: Undefined index: From US_Asterisk_Phonebook in callerid.php on line 237
18
History
Updated by tshif 11 months ago
- Status changed from New to Reviewed
- Priority changed from Low to Normal
- Target version set to Caller ID Superfecta v 2.2.2 Maintenance Release
Patrick - I realize these are only warngings - but Can you fix it so they are not occuring? I wouold rather hold release untill its repaired if you will accept the task.
Updated by tshif 11 months ago
- Due date set to 10/23/2009
- Status changed from Reviewed to Assigned
- Priority changed from Normal to Urgent
Updated by patrick_elx 11 months ago
I've got these errors when I'm receiving a real call. However with debug (even with test all cid checked) they do not occur....
Strange
Updated by tshif 11 months ago
Another good question - did you get the same results with 2.2.1, and or 2.2.0?
I am holding release untill we have a better understanding of this situation. It will create support requests - and it would be best to fix it now if we can.
On the otherhand, if its been there since 2.2.0, I wont be as concerned. Just let me know if you intend to look at / fix.
Updated by patrick_elx 11 months ago
I tried to look at is briefly this morning but did not have any success to solve it in the time frame I had.
It's only warnings anywat. I would suggest that we just keep that as a low priority for the next upgrade. It should not be a blocking factor for the 2.2.2 release. I'm more concerned about Infobel that needs more work on the charset translation issue.
Updated by tshif 11 months ago
Yes - this and infobel are both of concern. But as far as this issue being in the core module - and requiring a module release to correct - im reluctant to release untill its fixed. I know its just wanrings, ut this truly upset some people. Let us think of it for a time. FOr now, Im holding the release. I too will try and see if I can dig deeper - but so far im not having luck either.
Updated by tshif 11 months ago
Research:
I'll quote from the helpful resource http://www.phpbuilder.com/columns/dario19990616.php3 "In order to be taken literally, you must escape the characters "^.[$()|*+?{\" with a backslash ('\'), as they have special meaning." The article also points out: - you may need to escape a character twice because some characters need to be escaped in a PHP string too! - the case if different when characters are in [] square brackets. $returnurl_strip=split("\?sid=","$returnurl"); I got the same error when I didn't use the escape in front of the ? in the split function
Ok - since the errors are about the split function, and it includes the special character "+", I suggest we try escaping the plus sign and see if that doesnt fix the entire loop.
reference line 692, callerid.php
Updated by tshif 11 months ago
- File callerid.php added
Here is a patched file. I dont know how to generate the errors - so I cant tell if this fixed them or not - please somebody test this.
Updated by tshif 11 months ago
Ive looked in my logs and still dont see these errors. The pathced file seems to run, and returns CID values and no visible errors.
Updated by tshif 11 months ago
Well - darn. I just spent two hours trying to figure out where these errors would show up if I ever got them at all and now - I have no where else to look. I did check php.ini, used locate for any file with name php.log etc,
With our without the patch I posted, I cant see, create, or even find these errors.
We will just have to wait untill someone who gets these errors is available to test the patch. Also - please tell me where I find these errors - I will keep testing myself.
Updated by patrick_elx 11 months ago
Unfortunately I've also seen this escape issue and I tried this solution without success.
With your file the module is broken, I don't have any answer and the log (for me in var/log/httpd/error_log) give now:
[Fri Oct 23 19:47:27 2009] [notice] child pid 29547 exit signal Segmentation fault (11)
Updated by tshif 11 months ago
Ive been running this patch in production pbx all afternoon - and its working. Cant be that broken. Can you recheck? I wish I could see the error take place. :)
Updated by tshif 11 months ago
Found a log! Hurray! Thanks Patrick. Weirdly - I STILL dont get the same errors you do, before or after the patch! These are all I get either way:
Fri Oct 23 17:12:26 2009] [error] [client 127.0.0.1] PHP Notice: Undefined index: scheme in /var/www/html/admin/modules/superfecta/bin/callerid.php on line 22
[Fri Oct 23 17:12:26 2009] [error] [client 127.0.0.1] PHP Notice: Undefined index: Default_Asterisk_Phonebook in /var/www/html/admin/modules/superfecta/bin/callerid.php on line 239
Updated by patrick_elx 11 months ago
your code does not return error when you use a test scheme without any CID rules, however if there are CID rules in the list, I have the segmentation error I mentioned earlier.
Also, in code cleanup, I achieved to remove this error: [error] PHP Notice: Undefined index: scheme in callerid.php on line 20
change line 20 to
[code]
$scheme = (isset($_REQUEST['scheme']))? trim($_REQUEST['scheme']) : '';
[/code]
Updated by patrick_elx 11 months ago
Could be related to this bug http://bugs.php.net/bug.php?id=1710
Updated by patrick_elx 11 months ago
corrected another warning by moving the initialization of first_callerid at the beginning of the code.
last two minor corrections uploaded to SVN rev 199
Updated by tshif 11 months ago
I was wondering if differing version of php might be part of why people are getting differing results (come get the warnings, some do not, etc). It seems like that is still a possibility.
Very very very nice progress on warnings. What does your log look like now?
Updated by tshif 11 months ago
What would you think of putting a directive in the script itself to suppress all errors. (This example does the opposite)
error_reporting(E_ALL);
I think its this: error_reporting(0);
Updated by tshif 11 months ago
- Status changed from Assigned to Closed
- % Done changed from 60 to 100
QS: Pass, with reservations.
callerid.php still throws warnings in at least one version of php, although the code still apparently works.
accepted for build 2.2.2
A new case will be opened for code cleanup and php warnings in `future versions` track.