Division by zero in BxDolPaginate.php

I think this has been reported before but I will report it again just so it is on record.  I installed the files module and I am seeing a division by zero error.  There are no files on the system yet so that might be the cause.  Now, while division by zero is undefined (0! is defined as 1 so we can divide by it) we can approach division by zero by taking the limit.  Sorry, the geek in me coming out Cool

 

Warning: Division by zero in BxDolPaginate.php on line 203 

Geeks, making the world a better place
Quote · 13 Dec 2013

This usually happens only if you change one of the "how many files to show ..." or "how many folders to show..." options in the settings to zero. None of those settings can be zero. If you do not want a particular block to show you have to remove it via the page builder.

Paypal email is jeromemingo@gmail.com - http://www.boonex.com/market/posts/modzzz
Quote · 13 Dec 2013

 

This usually happens only if you change one of the "how many files to show ..." or "how many folders to show..." options in the settings to zero. None of those settings can be zero. If you do not want a particular block to show you have to remove it via the page builder.

 yep, exactly it says division by 0 not division of 0 by any number. Its a fact in maths that "a/0" is not defined.

so much to do....
Quote · 13 Dec 2013

 

 

This usually happens only if you change one of the "how many files to show ..." or "how many folders to show..." options in the settings to zero. None of those settings can be zero. If you do not want a particular block to show you have to remove it via the page builder.

 yep, exactly it says division by 0 not division of 0 by any number. Its a fact in maths that "a/0" is not defined.

You are going to have to explain this one as it sounds like double-speak.  Division by zero is undefined in maths and PHP knows this and the programmers that programmed the code must have slept in maths.  PHP knows that you can not divide by zero as well, otherwise it could result in some weird stuff.  They fail to put in a check; a simple check if <= 0; sloppy programming like this for a programme with a license fee of $799.00?

Geeks, making the world a better place
Quote · 13 Dec 2013

Thanks Modzz but it is still a bug; a programming error.  Programmers are suppose to check for such conditions; not have PHP report a division by zero error.  Boonex needs to fix this.  Come on Modzz, this is programming 101; hell, this is pre-programming 101.

Now, I can not report a ticket on this but I fully expect one of Andrew's coders to make a ticket and fix it.  Or maybe a big blog post out on my non-Boonex blog about how Dolphin has such simple programming bugs in it for a license fee of $799.00.

Geeks, making the world a better place
Quote · 13 Dec 2013

My response was simply to enlighten those who are getting the error about how they can avoid getting it.

Paypal email is jeromemingo@gmail.com - http://www.boonex.com/market/posts/modzzz
Quote · 13 Dec 2013

 

My response was simply to enlighten those who are getting the error about how they can avoid getting it.

 Oh, I understand Modzz, thank you for your explanation.  If there is not a ticket on this, can you make one because it should be fixed.

Geeks, making the world a better place
Quote · 13 Dec 2013

It could be changed to put 1 if 0 is given but then another problem is that user might get confused why its showing 1 per page when they put 0 there (another bug report?). Or perhaps an exception could be thrown if 0 is found. Well it all depends on several factors like, What was the time of the day the programmer was programming it. How was the weather outside. How much attentive he was. Was there any other people in the room. And most important, How much coffee he had.

so much to do....
Quote · 13 Dec 2013

The most logical thought that I have is: If admin does not want to show any items (such as files) on the specific page, then dont set the per page to 0, just move the block to inactive. So logically speaking, there should never be a '0' for how many to show per page. (just my thoughts supporting what modzz said)

caredesign.net
Quote · 13 Dec 2013

NO, everyone is missing the point here. this has nothing to do with a Dolphin error report.  This is a PHP error report, code level error report.  The programmers did not do a proper check.  The Dolphin programmers set up a condition by which a division by zero can take place.  This is a logic error, because you can not divide by zero.  If Andrew's coders can not understand something as simple as this, then what the hell?  You have an admin setting.  If it is set to zero, return.  In Dolphin, PHP blocks that don't return anything are not displayed by default.  This is a freaking bug and it needs to be fixed.  You should not have php code where a division by zero can occur.  You are doing bloody maths, if you don't understand the conditions then go be a Wally World greeter.

Geeks, making the world a better place
Quote · 14 Dec 2013

And where are the bleeding Boonex developers?  If they don't go anywhere else on the forums, they should be reading the bloody bug reports every bleeding day.

Geeks, making the world a better place
Quote · 14 Dec 2013

someone is angry...Innocent

so much to do....
Quote · 14 Dec 2013

 

someone is angry...Innocent

I have cooled down :-).  Seriously, division is one of those areas in programming where you have to understand that a division by zero can occur.  Any programmer that has code that is doing division knows that one does have to check for the condition of where the denominator could possibly be zero.  You just don't assume that it never will be and guess what, in Dolphin it can be.

I will email this topic to Andrew Boon, perhaps he has an interest in his platform not containing such a ridiculous bug.

Geeks, making the world a better place
Quote · 14 Dec 2013

It was over looked most likely. It was most likely assumed that it would not have ever reached that point. The error is occurring in BxDolPaginate. But to reach that, there has to actually be files.

A check for 0 files does exist in the code. So if there were no files it would have never reached that section of code. But i am guessing they assumed someone would have never actually tried to set a per page value of 0.

But setting it at 0 would not have the affect you think anyway. At least not at that function. Simply returning at that point would not be like returning at the start before the block is generated which would prevent the block from being displayed. So they will have to do something different to resolve it.

https://www.deanbassett.com
Quote · 14 Dec 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.