UCP error division by zero

Hi Andrew!

I over simplified things, my point was that there was not much I could do besides identifying which module was involved in the crash.

I knew a stack trace was required, this is why I had them replace $e->getMessage() with $e->getTraceAsString().

This is what doing this gave us earlier, this is why I suggested they remove Fax Pro to see if UCP would stop crashing.

There was an error trying to load UCP:

#0 /var/www/html/admin/modules/faxpro/ucp/Faxpro.class.php(27): Whoops\Run->handleError(2, 'Division by zer...', '/var/www/html/a...', 27, Array) 
#1 /var/www/html/admin/modules/ucp/htdocs/includes/Module_Helpers.class.php(119): UCP\Modules\Faxpro->__construct(Object(UCP\Modules)) 
#2 /var/www/html/admin/modules/ucp/htdocs/includes/Module_Helpers.class.php(33): UCP\Module_Helpers->autoload('Faxpro')
#3 /var/www/html/admin/modules/ucp/htdocs/includes/Modules.class.php(84): UCP\Module_Helpers->__get('Faxpro')
#4 /var/www/html/admin/modules/ucp/htdocs/includes/Modules.class.php(105): UCP\Modules->moduleHasMethod('Faxpro', 'getMenuItems') 
#5 /var/www/html/admin/modules/ucp/htdocs/includes/Modules.class.php(163): UCP\Modules->getModulesByMethod('getMenuItems') 
#6 /var/www/html/admin/modules/ucp/htdocs/index.php(106): UCP\Modules->getActiveModules()
#7 {main}

(I reformated it to make it more readable…)

re: UCP error division by zero - #12 by Marbled

Now from what I have read Faxpro.class.php at line 27 is possibly not the line where there is a division by zero but the first line of the method (constructor?) where an operation that results in a division by zero is.

re: The first comment of PHP: Exception::getTraceAsString - Manual

There is apparently another way to get a stack trace with more details but it would have involved having to code it (or find some helper function in FreePBX source code that does it).

Would removing the try catch completely gave us more information? Unfortunately, it is too late for that now…

edit: I don’t think it would… Now that I had reformated the stack trace and had the time to look at this further it looks like line 27 is actually error handling code most likely called from another try-catch…

Unless that method/function is extremely long and with multiple divide operations (or something that would result in a divide) I am pretty sure that if this was one of the application I maintain I would have enough information to go on with what @aj2 provided…

I also have a feeling that this is code that was modified after the migration script was published so comparing what was there at the time to what is currently there would most likely severely limit the number of “suspects” :wink:.

Honestly, right now and considering we had two people in close succession report this problem, I would not be surprised if breaks for everyone who migrates right now. This might actually be easy to replicate in-house

:wink:

Andrew, my main job is programming and I have been doing this for over 20 years now…

I have a more important technical/network admin like background than most programmers but I am still a programmer and I know what is needed in order to track down a problem (ie a stack trace).

I will include what I posted in this ticket, hopefully that will be enough to track down the problem as far as Fax Pro is concerned.

Problem is, while I think Fax pro and UCP should be more tolerant to a situation like this and not make UCP entirely unusable like it did for @aj2 and @sysdg, that it should only warn that there is a problem, it sounds to me like this is a problem with the migration program/script, not with Fax Pro itself.

Something seems not to be initialized properly during the migration.

When the migration program/script was released things were most likely OK as far as Fax Pro was concerned but something was most likely added to Fax Pro which is causing problems now…

When I open that ticket do you want me to open it under (what component, etc…)? I am not quite sure since it was UCP that was crashing but because of code in Fax Pro but that code was most likely crashing because the migration script/program did not initialize something correctly…

Have a nice day!

Nick