Ticket #3116 (closed Bugs: fixed)

Opened 3 months ago

Last modified 3 months ago

switching back to extensions from device and user

Reported by: lostdave Assigned to: p_lindheimer
Priority: minor Milestone: 2.5
Component: Core Version: 2.5-branch
Keywords: Cc:
Confirmation: Need testing SVN Revision (if applicable):
Backend Engine: Asterisk 1.4.x Backend Engine Version:

Description

repro: If you are running in deviceanduser, log a user out of an extension do not reassign the user to an extension, then switch to extension mode apply conf reload then try and edit the extension

Warning: Invalid argument supplied for foreach() in /var/www/html/admin/modules/core/functions.inc.php on line 4599

Change History

08/27/08 00:20:00 changed by lostdave

associated block of code looks like this:

 foreach ($devopts as $devopt=>$devoptarr) {
                        $devopname = 'devinfo_'.$devopt;
                        $devoptcurrent = isset($$devopname) ? $$devopname : $devoptarr['value'];
                        $devoptjs = isset($devoptarr['jsvalidation']) ? $devoptarr['jsvalidation'] : '';
                        $devoptfailmsg = isset($devoptarr['failvalidationmsg']) ? $devoptarr['failvalidationmsg'] : '';

08/27/08 07:28:31 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need testing.

try this to remove the error:

Index: functions.inc.php
===================================================================
--- functions.inc.php   (revision 6483)
+++ functions.inc.php   (working copy)
@@ -4595,6 +4595,7 @@
 
                $section = _("Device Options");
                $currentcomponent->addguielem($section, new gui_label('techlabel', sprintf(_("This device uses %s technology."),$devinfo_tech)),4);
+               $devopts = array();
                $devopts = $currentcomponent->getgeneralarrayitem('devtechs', $devinfo_tech);
                foreach ($devopts as $devopt=>$devoptarr) {
                        $devopname = 'devinfo_'.$devopt;

08/27/08 14:17:12 changed by lostdave

Patched against 6487

Notice: does not exist in array 'devtechs' in /var/www/html/admin/components.class.php on line 221

Warning: Invalid argument supplied for foreach() in /var/www/html/admin/modules/core/functions.inc.php on line 4599

08/27/08 14:36:41 changed by p_lindheimer

oops, duh, bad patch, I wasn't thinking. Try this, and as far as the Notice, you generally don't want to be running with Notices as you will probably get a lot, some of them valid (like when dealing with php 4/5 differences).

Index: functions.inc.php
===================================================================
--- functions.inc.php   (revision 6483)
+++ functions.inc.php   (working copy)
@@ -4596,16 +4596,18 @@
                $section = _("Device Options");
                $currentcomponent->addguielem($section, new gui_label('techlabel', sprintf(_("This device uses %s technology."),$devinfo_tech)),4);
                $devopts = $currentcomponent->getgeneralarrayitem('devtechs', $devinfo_tech);
-               foreach ($devopts as $devopt=>$devoptarr) {
-                       $devopname = 'devinfo_'.$devopt;
-                       $devoptcurrent = isset($$devopname) ? $$devopname : $devoptarr['value'];
-                       $devoptjs = isset($devoptarr['jsvalidation']) ? $devoptarr['jsvalidation'] : '';
-                       $devoptfailmsg = isset($devoptarr['failvalidationmsg']) ? $devoptarr['failvalidationmsg'] : '';
-
-                       if ( $devoptarr['level'] == 0 || ($extdisplay && $devoptarr['level'] == 1) ) { // editing to show advanced as well
-                               $currentcomponent->addguielem($section, new gui_textbox($devopname, $devoptcurrent, $devopt, '', $devoptjs, $devoptfailmsg), 4);
-                       } else { // add so only basic
-                               $currentcomponent->addguielem($section, new gui_hidden($devopname, $devoptcurrent), 4);
+               if (is_array($devopts)) {
+                       foreach ($devopts as $devopt=>$devoptarr) {
+                               $devopname = 'devinfo_'.$devopt;
+                               $devoptcurrent = isset($$devopname) ? $$devopname : $devoptarr['value'];
+                               $devoptjs = isset($devoptarr['jsvalidation']) ? $devoptarr['jsvalidation'] : '';
+                               $devoptfailmsg = isset($devoptarr['failvalidationmsg']) ? $devoptarr['failvalidationmsg'] : '';
+
+                               if ( $devoptarr['level'] == 0 || ($extdisplay && $devoptarr['level'] == 1) ) { // editing to show advanced as well
+                                       $currentcomponent->addguielem($section, new gui_textbox($devopname, $devoptcurrent, $devopt, '', $devoptjs, $devoptfailmsg), 4);
+                               } else { // add so only basic
+                                       $currentcomponent->addguielem($section, new gui_hidden($devopname, $devoptcurrent), 4);
+                               }
                        }
                }
        }

08/27/08 16:26:47 changed by lostdave

That sorts it :-)

08/27/08 19:26:07 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to fixed.

(In [6488]) closes #3116 remove warning

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads