<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Bug due to commit]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7886</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7886&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Bug due to commit.]]></description>
		<lastBuildDate>Sun, 16 Dec 2018 15:22:41 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33644#p33644</link>
			<description><![CDATA[<p>It works in PHP 5.3.1 on WinXP3 as well (XAMPP 1.7.3).</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 16 Dec 2018 15:22:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33644#p33644</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33641#p33641</link>
			<description><![CDATA[<p>Hello again,</p><p>I have now tested your example, @notrinos, and it doesn&#039;t work as intended.<br />I have now changed the function count_array($array) in /includes/ui/ui_globals.inc to this:<br /></p><div class="codebox"><pre><code>function count_array($array)
{
    return (is_array($array)) ? count($array) : (($array === NULL) ? 0 : 1);
}</code></pre></div><p>and it works for PHP versions 7.2.12, 7.1.9, 7.0.23, 5.6.31, 5.5.25 and 5.4.10.</p><p>It gives the same return as the old count() without errors or warnings.<br />We only have to convert more counts() if we detect more errors. We can wait until next major to do this.</p><p>This has now been committed and a new file can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/includes/ui/ui_globals.inc">here</a>:</p><p>/Joe.</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sun, 16 Dec 2018 15:16:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33641#p33641</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33636#p33636</link>
			<description><![CDATA[<p>ok, I will just test this before committing.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sun, 16 Dec 2018 13:45:26 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33636#p33636</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33635#p33635</link>
			<description><![CDATA[<p>before the function count_array() was deployed we used PHP build in function count() for validating both array and number<br />since the count() has been changed to validate array, object only so we need to create new function in FA for checking both number and array.<br />The current function count_array() should be modified to:<br /></p><div class="codebox"><pre><code>function fa_count($input)
{
    if(is_array($input))
        return count($input);
    elseif(ctype_digit($input) &amp;&amp; (int)$input &gt; 0)
        return (int)$input;
    else
        return 0;
}</code></pre></div><p>Do this we could change every curently count() to fa_count() without worry about errors that may arise somewhere.</p>]]></description>
			<author><![CDATA[null@example.com (notrinos)]]></author>
			<pubDate>Sun, 16 Dec 2018 13:20:33 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33635#p33635</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33633#p33633</link>
			<description><![CDATA[<p>@joe<br />my function is not working because it is called inside function get_sales_child_documents which use 3 times in file view_sales_order.php validating for both number and array.</p><p>your solution is working in this case but seems we still need a function to check both array element and number</p>]]></description>
			<author><![CDATA[null@example.com (notrinos)]]></author>
			<pubDate>Sun, 16 Dec 2018 13:07:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33633#p33633</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33631#p33631</link>
			<description><![CDATA[<p>@notrinos</p><p>The function is_positive_int doesn&#039;t work as you provide in php 7.2.</p><p>However changing <br /></p><div class="codebox"><pre><code>if (!is_positive_int($trans_no))
to
if (!trans_no)
do work.</code></pre></div><p>what do you think?</p><p>joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sun, 16 Dec 2018 12:32:45 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33631#p33631</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33630#p33630</link>
			<description><![CDATA[<p>yes, function count_array() is for the purpose as of its name.<br />all places that are checking positive intergers need a different function.</p><div class="codebox"><pre><code>function is_positive_int($input)
{
    if(ctype_digit($input) &amp;&amp; (int)$input &gt; 0)
        return true;

    return false;
}</code></pre></div><p>and line 371 of sales_db.inc needs to be modified to :<br /></p><div class="codebox"><pre><code>if (!is_positive_int($trans_no))</code></pre></div><p>also roll back the last commit.</p>]]></description>
			<author><![CDATA[null@example.com (notrinos)]]></author>
			<pubDate>Sun, 16 Dec 2018 11:58:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33630#p33630</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33624#p33624</link>
			<description><![CDATA[<p>Found this <a href="https://github.com/FrontAccountingERP/FA/commit/f9dd78a24383c61eaed49836155d673cb2f913ca#r31692518">bug</a> after new commit</p><p>And I doubt <a href="https://github.com/FrontAccountingERP/FA/commit/ad0504645e3632d169d0f253bb5eb4db8b7e18b9#r31692538">this one</a> also have logical error after this new commit.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sun, 16 Dec 2018 10:43:23 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33624#p33624</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33622#p33622</link>
			<description><![CDATA[<p>I guess you are right guys. Sorry that we didn&#039;t detect this before the minor release. However now it seems to work.<br />Please help me test it. You can make a global search on count_array and try to run the routines involved. It should be 6 files.</p><p>Committed to stable repo. New file can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/includes/ui/ui_globals.inc">here</a>.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sun, 16 Dec 2018 07:40:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33622#p33622</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33620#p33620</link>
			<description><![CDATA[<p>@joe: Please commit this and verify that all files that partook of this change and the ones before this function came in are all okay.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 16 Dec 2018 06:26:34 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33620#p33620</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33619#p33619</link>
			<description><![CDATA[<p>Yes changing the return to 1 has worked.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sun, 16 Dec 2018 06:07:45 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33619#p33619</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33605#p33605</link>
			<description><![CDATA[<p>The following test code was executed in PHP 5.3.3:<br /></p><div class="codebox"><pre><code>    $a = 0; // Scalar
    $b = count($a);
    echo var_dump($b); // returns int(1)

    $a = array(); // Array
    $b = count($a);
    echo var_dump($b); // returns int(0)</code></pre></div><p>Hence we should return a 1 if it is a scalar and not a 0!</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 15 Dec 2018 17:12:05 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33605#p33605</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33599#p33599</link>
			<description><![CDATA[<p>Which version of PHP are you using?<br />Make a test script with empty array and see what appears in var_dump on using the new function.</p><p>In the old dispensation, the argument could be either an array or a scalar and the count() faithfully returned an acceptable result - was it a 0 or just false? In the current codebase, it will return a 0 if &quot;it is a scalar&quot; and also &quot;even if it is an array and if the array has no elements&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 15 Dec 2018 14:46:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33599#p33599</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33594#p33594</link>
			<description><![CDATA[<p>Please try to give more details about this. I don&#039;t know how to fix it.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sat, 15 Dec 2018 06:05:26 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33594#p33594</guid>
		</item>
		<item>
			<title><![CDATA[Bug due to commit]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33591#p33591</link>
			<description><![CDATA[<p>This <a href="https://github.com/FrontAccountingERP/FA/commit/ad0504645e3632d169d0f253bb5eb4db8b7e18b9#r31688124">commit</a> has created a bug shown in image.</p><p>I could have caught just one. May be this is affecting other places too.</p><p>Please rectify.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sat, 15 Dec 2018 05:20:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33591#p33591</guid>
		</item>
	</channel>
</rss>
