<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Error Handler not working for php 8.2]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10432&amp;type=atom" />
	<updated>2024-03-29T08:15:44Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=10432</id>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42982#p42982" />
			<content type="html"><![CDATA[<p>Fixed both errors. The one in gl/inquiry/profit_loss.php and the one in inventory/manage/items.php.</p><p>Pushed to stable repo.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2024-03-29T08:15:44Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42982#p42982</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42981#p42981" />
			<content type="html"><![CDATA[<p>Will check on this today.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2024-03-29T05:13:44Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42981#p42981</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42980#p42980" />
			<content type="html"><![CDATA[<p>The function display_type() is defined separately in each of these reports in the reporting folder:<br /></p><div class="codebox"><pre><code>rep701.php
rep705.php
rep706.php
rep707.php
rep708.php</code></pre></div><p>where the said <strong>$path_to_root</strong> is not used.</p><p>The <strong>$path_to_root</strong> variable is defined as global in <strong>gl/inquiry/balance_sheet.php</strong> as a standalone function.</p><p>The only place where the function needs to be changed is in <strong>gl/inquiry/profit_loss.php</strong>. It is defined in line 57 and is used in lines 108, 264 and 320.</p><p>In each case, the locally defined functions are not used outside the specific file.</p><p>@joe: kindly make the changes in <strong>gl/inquiry/profit_loss.php</strong>.</p><p>Those files in extensions who &quot;include&quot; this file should be aware of such a change and make amends if and when this is committed.</p><p>@joe: can commit changes to this file as needed.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2024-03-29T04:37:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42980#p42980</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42976#p42976" />
			<content type="html"><![CDATA[<p>We have another required parameter after the optional parameter.</p><p>on profit_loss.php </p><div class="codebox"><pre><code>function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $convert,
    $dimension=0, $dimension2=0, $drilldown, $path_to_root)</code></pre></div><p>here <strong>$drilldown</strong> can be put default value as 0</p><p>And <strong>$path_to_root</strong> can be declared as global variable inside the display_type</p><div class="codebox"><pre><code>function display_type ($type, $typename, $from, $to, $begin, $end, $compare, $convert,
    $dimension=0, $dimension2=0, $drilldown=0) {
        global $path_to_root;</code></pre></div><p>this will work there</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2024-03-27T04:59:49Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42976#p42976</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42915#p42915" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>apmuthu wrote:</cite><blockquote><p>A note page in the wiki would be good to know the extent of PHP version compatibility for each release.</p></blockquote></div><p>A sticky message in its own forum would also work</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2024-02-26T14:36:19Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42915#p42915</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42914#p42914" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>apmuthu wrote:</cite><blockquote><p>Let us freeze the PHP version for this FA version.<br />People should not keep updating PHP version frequently.</p></blockquote></div><p>I totally agree, but from personal experience updating is driven by the hosting companies; changing version without notice and often to obscure version numbers; then in some cases, not allowing previous versions to be used. Yes you get what you pay for, but initially most users will factor cost when choosing hosting.</p><p>I have no answers, but I would very much like to see a solution to this.</p>]]></content>
			<author>
				<name><![CDATA[poncho1234]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19944</uri>
			</author>
			<updated>2024-02-26T14:34:52Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42914#p42914</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42911#p42911" />
			<content type="html"><![CDATA[<p>With this code </p><div class="codebox"><pre><code> srand ((double) microtime( )*1000000); </code></pre></div><p> </p><p>we are getting error like this in sometime <strong>Implicit conversion from float 517375.00000000006</strong>. due to the double in it. so lets convert this into int.</p><div class="codebox"><pre><code> srand ((int) microtime( )*1000000); </code></pre></div><p>&nbsp; </p><p>make this change on items.php to take effect.</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2024-02-26T12:33:11Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42911#p42911</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42826#p42826" />
			<content type="html"><![CDATA[<p>I am feeling this change will get it worked. </p><p>@joe consider checking it on php 8.1 and 8.2 with existing code and also my new function of db_query </p><br /><br /><div class="codebox"><pre><code>function db_query($sql, $err_msg=null)
{
    global $db, $SysPrefs, $sql_queries, $Ajax,    $db_connections, $db_last_inserted_id;

    // set current db prefix
    $comp = isset($_SESSION[&quot;wa_current_user&quot;]-&gt;cur_con) ? $_SESSION[&quot;wa_current_user&quot;]-&gt;cur_con : 0;
    $cur_prefix = @$db_connections[$comp][&#039;tbpref&#039;];
    $sql = str_replace(TB_PREF, $cur_prefix, $sql);

    if ($SysPrefs-&gt;show_sql)
    {
        $Ajax-&gt;activate(&#039;footer_debug&#039;);
        $sql_queries .= &quot;&lt;pre&gt;$sql&lt;/pre&gt;\n&lt;hr&gt;&quot;;
    }

    db_profile(); // mysql profiling

    $retry = MAX_DEADLOCK_RETRY;
 try { //kvvaradha added try and catch 
    do {
        $result = mysqli_query($db, $sql);
        if (mysqli_errno($db) == 1213)    { // deadlock detected
            sleep(1); $retry--;
        } else {
            throw new mysqli_sql_exception(&quot;Deadlock detected: $sql&quot;, 1062); //kvvaradha added to through the error in an exception and handle it on catch 
            $retry = 0;
        }
    } while ($retry);

    db_profile($sql);

    if($SysPrefs-&gt;sql_trail) {
        $db_last_inserted_id = mysqli_insert_id($db);    // preserve in case trail insert is done
        if ($SysPrefs-&gt;select_trail || (strstr($sql, &#039;SELECT&#039;) === false)) {
            mysqli_query($db, &quot;INSERT INTO &quot;.$cur_prefix.&quot;sql_trail
                (`sql`, `result`, `msg`)
                VALUES(&quot;.db_escape($sql).&quot;,&quot;.($result ? 1 : 0).&quot;,
                &quot;.db_escape($err_msg).&quot;)&quot;);
        }
    }
 } catch (mysqli_sql_exception $e) {. //kvvaradha added catch 
        $error_msg = $e-&gt;getMessage();
        $error_code = $e-&gt;getCode();
    if ($err_msg != null || $SysPrefs-&gt;go_debug) {
        $exit = $err_msg != null;
        if (function_exists(&#039;xdebug_call_file&#039;))
            $err_msg = &#039;&lt;br&gt;At file &#039;.xdebug_call_file().&#039;:&#039;.xdebug_call_line().&#039;:&lt;br&gt;&#039;.$err_msg;
        check_db_error($err_msg, $sql, $exit);
    }
 throw $e; // rethrow the exception after handling
    }
    return $result;
}</code></pre></div><p>I added error handling with try catch inorder to get the detailed query during the time of mysqli_sql_exception.</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2024-01-17T14:00:37Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42826#p42826</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42815#p42815" />
			<content type="html"><![CDATA[<p>Let us freeze the PHP version for this FA version.<br />People should not keep updating PHP version frequently.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2024-01-13T19:33:40Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42815#p42815</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42803#p42803" />
			<content type="html"><![CDATA[<p>For this issue. We should update on our FA program. I guess not on wiki. People needs to move to next php versions. So it&#039;s important to fix in core of FA</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2024-01-07T13:18:34Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42803#p42803</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42791#p42791" />
			<content type="html"><![CDATA[<p>A note page in the wiki would be good to know the extent of PHP version compatibility for each release.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2024-01-06T19:19:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42791#p42791</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Error Handler not working for php 8.2]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=42756#p42756" />
			<content type="html"><![CDATA[<p>When we even turn on the go_debug 2. that doesnt get the mysql errors like 1062 duplicate entry, 1054 column not found errors are not showing the query which get this error.&nbsp; But in php 8.0 it works fine. </p><p>We need to update the error handler or fix it work based on php 8.2</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2023-12-08T05:34:10Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=42756#p42756</id>
		</entry>
</feed>
