<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title></title>
        <link>https://interactivetools.com/forum/forum-search.php?k=user%3Arunriot</link>
        <description></description>
        <pubDate>Sun, 05 Apr 2026 06:36:26 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-search.php?k=user%3Arunriot&amp;rss=1" rel="self" type="application/rss+xml" />

                <item>
          <title>Potential minor bug in getNewPasswordErrors</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248059#post2248059</link>
          <description><![CDATA[<p>Hey,</p>
<p>v3.78</p>
<p>lib/Password.php</p>
<p>Line 109/110:</p>
<pre class="language-php"><code>// allow plugins to add additional password rules
$errors = \Plugin::filter('login_newPasswordErrors', $errors, $passwordText);</code></pre>
<p>Prior to this, $error is an array e.g.</p>
<pre class="language-php"><code>$errors[] = t("Password cannot start with $hashPrefix");</code></pre>
<p>So, if the <span>login_newPasswordErrors returns anything, it <strong>overwrites</strong> any $errors[] that may have also been triggered.</span></p>
<p><span>I've applied this, and it allows both the core password errors AND anything added by the filter to be combined into the one error array:</span></p>
<pre class="language-php"><code>$extraErrors = \Plugin::filter('login_newPasswordErrors', $errors, $passwordText);     
$errors = array_merge($errors, $extraErrors);</code></pre>
<p>For context (i.e. because maybe I'm using this addFilter wrong..!) my <span><em>login_newPasswordErrors</em> filter is set up like this:</span></p>
<pre class="language-php"><code>addFilter('login_newPasswordErrors', 'customPasswordErrors', null, 4);</code></pre>
<p><span>and the <em>customPasswordErrors</em> function returns an array.</span></p>
<p><span>Cheers</span></p>
<p><span>Rob</span></p>]]></description>
          <pubDate>Thu, 17 Jul 2025 18:45:38 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248059#post2248059</guid>
        </item>
                <item>
          <title>v3.78 - general_server_info.php tweak</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248053#post2248053</link>
          <description><![CDATA[<p>Hey,</p>
<p>In <em>/cmsAdmin/lib/menus/general_server_info.php</em></p>
<p>Line 307:</p>
<pre class="language-php"><code>$dbHaveSSL         = mysql_get_query("SHOW VARIABLES WHERE Variable_name IN ('have_ssl')")['Value']; // Disabled, Yes, No
</code></pre>
<p>Can return:</p>
<p><em><strong>Warning: Trying to access array offset on null</strong></em></p>
<p>In some infrastructure / networking cases..</p>
<p>I've changed it locally to:</p>
<pre class="language-php"><code>$dbHaveSSLresult = mysql_get_query("SHOW VARIABLES WHERE Variable_name = 'have_ssl'");   

$dbHaveSSL = $dbHaveSSLresult['Value'] ?? null;</code></pre>
<p>to prevent the Warning.</p>
<p>Can it be patched into the next version? :-)</p>
<p>Cheers</p>
]]></description>
          <pubDate>Fri, 11 Jul 2025 00:56:11 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248053#post2248053</guid>
        </item>
                <item>
          <title>Facebook ads - fbclid error</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248045#post2248045</link>
          <description><![CDATA[<p>Hey,</p>
<p>Not sure on your end goal with $recordNum, but that code will still pass <span style="text-decoration:underline;">fbclid</span> (and those others) to your<em> $recordNum</em>, which could potentially still cause problems down the line.</p>
<p>Without seeing what you then do with $recordNum, I'm guessing it's used in a mysql_get/select to get the page record?</p>
<p>Cheers</p>]]></description>
          <pubDate>Tue, 01 Jul 2025 16:07:41 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248045#post2248045</guid>
        </item>
                <item>
          <title>Facebook ads - fbclid error</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248043#post2248043</link>
          <description><![CDATA[<p>What is each of these lines:<br />/home/luxurychartergroup/luxurychartergroup.com/fr/yacht-type.php -&gt; line 2</p>
<p><span>/home/luxurychartergroup/luxurychartergroup.com/fr/yacht-type.php -&gt; line 32</span></p>
<p><span>/home/luxurychartergroup/luxurychartergroup.com/404.php -&gt; line 2</span></p>
<p><span>It looks like your site is grabbing the </span><span>GET variable from the URL (in this case <strong><em>fbclid</em></strong>) and then using that to find a page/record in your database. It can't, so 404s.</span></p>
<p><span>My guess is your code is something like:</span></p>
<p><span>If there's a GET variable, use that to find the page</span></p>
<p><span>...but you're doing it for <strong>ANY</strong> GET variable, so it's using <em>fbclid</em> instead of whatever correct variable you use to get the correct page.</span></p>
<p><span>Proof of Concept:</span></p>
<p><span><a href="https://www.luxurychartergroup.com/fr/yacht-type.php/sailing-1/?foo=bar" rel="nofollow">https://www.luxurychartergroup.com/fr/yacht-type.php/sailing-1/?foo=bar</a></span></p>
<p><span>This also errors and 404s.</span></p>
<p><span>You need to harden your code to correctly define which GET variable you want to use, rather than any. If you show those lines, it'll likely be an easy fix.</span></p>
<p><span>Cheers</span></p>
<p><span>Rob</span></p>]]></description>
          <pubDate>Tue, 01 Jul 2025 12:25:32 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248043#post2248043</guid>
        </item>
                <item>
          <title>CMSB v3.78 Beta Released (PHP 8.1 Required, Plugin and Debug Tools)</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248031#post2248031</link>
          <description><![CDATA[<p>Awesome :-)</p>
<p>Does this release include the inclusion of <em>columnEncryptionKey </em>into the Env variables? And, the return of the <em>login_isValidLogin</em> hook (or similar) so we can add third party 2FA?</p>
<p>Cheers</p>
<p>Rob</p>

]]></description>
          <pubDate>Mon, 16 Jun 2025 19:25:00 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248031#post2248031</guid>
        </item>
                <item>
          <title>v3.77 - Error Log Bug - no dateLogged</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248025#post2248025</link>
          <description><![CDATA[<p>Hey Dave</p>
<p>Thanks - and yup, this has fixed it.<br /><br />Going from:</p>
<pre class="language-markup"><code>NULL DEFAULT \'0000-00-00 00:00:00\'</code></pre>
<p>to:</p>
<pre class="language-markup"><code>NULL DEFAULT CURRENT_TIMESTAMP</code></pre>
<p>Thanks :-)</p>]]></description>
          <pubDate>Thu, 12 Jun 2025 15:01:04 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248025#post2248025</guid>
        </item>
                <item>
          <title>v3.77 - General Settings - Server Info display bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248022#post2248022</link>
          <description><![CDATA[<p>Thanks - and yup, that fixes the issue.</p>]]></description>
          <pubDate>Wed, 11 Jun 2025 19:00:30 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248022#post2248022</guid>
        </item>
                <item>
          <title>v3.77 - General Settings - Server Info display bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248020#post2248020</link>
          <description><![CDATA[<p>Thanks Tim 👍</p>]]></description>
          <pubDate>Wed, 11 Jun 2025 18:47:51 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248020#post2248020</guid>
        </item>
                <item>
          <title>v3.77 - General Settings - Server Info display bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248018#post2248018</link>
          <description><![CDATA[<p>Hey</p>
<p>Both PROD and DEV are inside Docker containers, so maybe that's contributing to this?</p>
<p>phpinfo():</p>
<pre class="language-markup"><code>Configuration File (php.ini) Path: /usr/local/etc/php</code></pre>
<p>php --ini:</p>
<pre class="language-markup"><code>Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File:         (none)
Scan for additional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed:      /usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/uploads.ini</code></pre>
<p>So php --ini inside the container doesn't seem to report a loaded config file, but that's ok (I think) as we haven't seen any problems with this config for years now...! Pretty sure everything is well handled by the docker container base image. We are setting a few non-defaults in uploads.ini</p>
<p>Thoughts?</p>
<p>Cheers<br />Rob</p>]]></description>
          <pubDate>Wed, 11 Jun 2025 16:57:58 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248018#post2248018</guid>
        </item>
                <item>
          <title>v3.77 - Error Log Bug - no dateLogged</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248017#post2248017</link>
          <description><![CDATA[<p>Hey,</p>
<p>Yeah I wondered that.</p>
<p>The MySQL type for the dateLogged field is, as reported on admin.php?menu=database&amp;action=editTable&amp;tableName=_error_log is</p>
<p>datetime NOT NULL DEFAULT 0000-00-00 00:00:00</p>
<p>and in the schema file:</p>
<pre class="language-markup"><code>  'dateLogged' =&gt; [
    'customColumnType' =&gt; 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
    'label' =&gt; 'Date',
    'type' =&gt; 'date',
    'isSystemField' =&gt; 1,
    'defaultDate' =&gt; '',
    'defaultDateString' =&gt; '',
    'showTime' =&gt; 1,
    'showSeconds' =&gt; 1,
    'actualColumnType' =&gt; 'datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\'',
  ],
</code></pre>
<p>And all the entries in the MySQL table have dateLogged (and updatedDate) as 0000-00-00 00:00:00.</p>
<p>I see in other schema files, system date fields are:</p>
<pre class="language-markup"><code>  'updatedDate' =&gt; [
    'type' =&gt; 'none',
    'label' =&gt; 'Last Updated',
    'isSystemField' =&gt; '1',
  ],
</code></pre>
<p>So is there perhaps an issue with our schema config for _error_log.schema.php?</p>
<p>This install was recently upgraded from a very old verison (a good year + old) to 3.76 and then 3.77.</p>
<p>Cheers</p>
<p>Rob</p>]]></description>
          <pubDate>Wed, 11 Jun 2025 16:51:25 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248017#post2248017</guid>
        </item>
                <item>
          <title>v3.77 - General Settings - Server Info display bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248014#post2248014</link>
          <description><![CDATA[<p>Hey</p>
<p>When loading /admin.php?menu=admin&amp;action=general, it errors with:</p>
<pre class="language-markup"><code>absPath(): Argument #1 ($inputPath) must be of type string, bool given, called in /var/www/html/clinicAdmin/lib/menus/admin/general_server_info.php on line 425</code></pre>
<p>as per attached screenshot.</p>
<p>Coming from:</p>
<p><br /><span>general_server_info.php L425: </span></p>
<pre class="language-markup"><code>$loadedPhpIni  = absPath(php_ini_loaded_file(), \CMS::$rootDir);</code></pre>
<p><span>file_functions L10:</span></p>
<pre class="language-markup"><code>function absPath(string $inputPath, string $baseDir = '.'): string {</code></pre>

<p>Not sure if it's something specific to my server config causing this, but it's happening in both DEV and PROD.</p>
<p>Obviously not fatal, but annoying none the less as it triggers a Dev Log error email everytime someone accesses this page.</p>
<p>Cheers</p>
<p>Rob</p>]]></description>
          <pubDate>Wed, 11 Jun 2025 14:40:00 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248014#post2248014</guid>
        </item>
                <item>
          <title>v3.77 - Error Log Bug - no dateLogged</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2248013#post2248013</link>
          <description><![CDATA[<p>Hey</p>
<p>Errors logged into _error_log are being inserted without a <span>dateLogged, so they appear as "never" in the UI, as per attached screenshot.</span></p>
<p>Looking at</p>
<p><em>function errorDB_addErrorRecord($colsToValues):</em></p>
<p><span>and</span></p>
<p><em>function _errorlog_logErrorRecord</em></p>
<p><span>the dateLogged variable is not set anywhere within either of those.</span></p>
<p><span>Would likely make best sense to set it in the:</span></p>
<p><em> //  create log record data<br /></em><em>$colsToValues = [</em></p>
<p><span>errorlog_functions.php line 313</span></p>
<p><span>Cheers!</span></p>
<p><span>Rob</span></p>]]></description>
          <pubDate>Wed, 11 Jun 2025 14:20:48 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2248013#post2248013</guid>
        </item>
                <item>
          <title>Replacement for old login_isValidLogin plugin hook? (to allow for third party 2FA)</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247965#post2247965</link>
          <description><![CDATA[<p>Hey,</p>
<p>We used to use the plugin hook <em>login_isValidLogin</em> to add a third party 2FA to the CMS login process.</p>
<p>The hooked function would validate an extra input (the OTP code) on the login page (which itself is added by the <span>login_content hook).</span></p>
<p><span>The login_content plugin hook still exists, so we can display the OTP field on the login screen but the login_isValidLogin is gone from the latest versions of CMS, and looking through the new User and Password classes, there doesn't seem to be any hook to add in this extra check.</span></p>
<p><span>Perhaps it'd go into the <em>getLoginUserRecord</em> or <em>Password::isValid</em> functions.</span></p>
<p><span>Is there a way to do this from the latest version (v3.76)? If not, what's the chances of having it added in the next update? :-)</span></p>
<p><span>Or, even better, have 2FA/OTP baked into CMSB?</span></p>
<p><span>Thanks<br />Rob</span></p>]]></description>
          <pubDate>Thu, 29 May 2025 14:39:47 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247965#post2247965</guid>
        </item>
                <item>
          <title>CMSB v3.76 Released - Performance Optimizations</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247963#post2247963</link>
          <description><![CDATA[<p>Hey,</p>
<p>Really like the introduction of the .env.php files.</p>
<p>Can <em>columnEncryptionKey</em> (mysql) be added to the <em>fuction getSettingsToEnvMap,</em> so that all sensitive data is removed from the settings.dat.php files?</p>
<p>Ideally, also <em>smtp_hostname</em> and <em>adminUrl</em></p>
<p>Cheers</p>
<p>Rob</p>]]></description>
          <pubDate>Wed, 28 May 2025 20:53:48 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247963#post2247963</guid>
        </item>
                <item>
          <title>CMSB v3.69 Released (Apr 29) - Website/Code Backups</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247208#post2247208</link>
          <description><![CDATA[<p>Hey Dave,</p>
<p>Is there a built-in way to disable the Website/Code Backups option at a global (settings.dat.php) level? I can definitely see how it's handy for some, but with git and docker workflows, it's unnecessary and TBH, for security reasons, I don't want someone to be able to download the codebase just by having a CMS admin login.</p>
<p>I can remove it manually, but a built-in option would be great so I don't have to manually remove it again after any future upgrades.</p>
<p>Thanks</p>
<p>Rob</p>]]></description>
          <pubDate>Fri, 17 May 2024 07:51:28 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247208#post2247208</guid>
        </item>
                <item>
          <title>LEFT JOIN + default orderBy = bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247075#post2247075</link>
          <description><![CDATA[<p>Sorry for the barrage of posts, but this fixes it:</p>
<p>viewer_functions.php, line 568</p>
<p>Was:</p>
<pre class="language-markup"><code>  // create query
    $query = "SELECT COUNT(*)\n";
    $query .= "FROM `$TABLE_PREFIX{$options['tableName']}` as `{$options['tableName']}`\n";
    $query .= $LEFT_JOIN;
    $query .= "$where\n";
    $query .= (!empty($options['groupBy'])) ? " GROUP BY {$options['groupBy']}" : '';
    $query .= (!empty($options['having']))  ? " HAVING {$options['having']}" : '';
    $query .= (!empty($options['orderBy'])) ? " ORDER BY {$options['orderBy']}" : '';</code></pre>
<p>Now:</p>
<pre class="language-markup"><code>// create query
 $query = "SELECT COUNT(*)\n";
    $query .= "FROM `$TABLE_PREFIX{$options['tableName']}` as `{$options['tableName']}`\n";
    $query .= $LEFT_JOIN;
    $query .= "$where\n";
    $query .= (!empty($options['groupBy'])) ? " GROUP BY {$options['tableName']} . {$options['groupBy']}" : '';
    $query .= (!empty($options['having']))  ? " HAVING {$options['having']}" : '';
    $query .= (!empty($options['orderBy'])) ? " ORDER BY {$options['tableName']} . {$options['orderBy']}" : '';</code></pre>
<p>But this then can cause another error when a custom orderBy is defined already with a fully qualified field.</p>
<p>So I scrapped that idea and then I thought... arguably, SELECT COUNT doesn't need an orderBy as it will make no difference to the results of the COUNT, so just removed it entirely from this SELECT COUNT query.</p>
<p><em>groupBy</em> can cause this same ambiguous error but removing this from the COUNT does cause different results so this may need a better fix. For now, I have fixed this by fully qualifying it in the getRecords as I only have a few places.</p>
<p>I have not tested <em><strong>having</strong></em> as I have never used that.</p>]]></description>
          <pubDate>Fri, 29 Mar 2024 16:13:58 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247075#post2247075</guid>
        </item>
                <item>
          <title>LEFT JOIN + default orderBy = bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247074#post2247074</link>
          <description><![CDATA[<p>I've done some more digging and I think it's related to the <strong>COUNT</strong> which is performed as part of getRecords.</p>
<p>This works:</p>
<pre class="language-php"><code>SELECT `primary_table`.*,
`secondary_table`.`num` AS `secondary_table.num`,
`secondary_table`.`createdDate` AS `secondary_table.createdDate`
FROM `primary_table` as `records`
LEFT JOIN `secondary_table` AS `secondary_table` ON (primary_table.num = secondary_table.linked_field)
ORDER BY createdDate</code></pre>
<p>This doesn't work:</p>
<pre class="language-php"><code>SELECT COUNT(*)
FROM `primary_table` as `records`
LEFT JOIN `secondary_table` AS `secondary_table` ON (primary_table.num = secondary_table.linked_field)
ORDER BY createdDate</code></pre>
<p>and results in the error</p>
<pre class="language-php"><code>column createdDate in order clause is ambiguous</code></pre>
<p>And if I remove the COUNT entirely for testing</p>
<pre class="language-php"><code>// comment out for testing
// $totalRecords = mysql_get_query($countQuery, true)[0];</code></pre>
<p><span>from /lib/viewer_functions.php line 612, I do not get the error :-)</span></p>

<p><span>The previous CMS used the following for $totalRecords within <em>function_getRecords_loadResults:</em></span></p>
<pre class="language-php"><code>SELECT FOUND_ROWS()</code></pre>

<p><span>The new CMS uses the following:</span></p>
<pre class="language-php"><code>SELECT COUNT(*) FROM </code></pre>

<p>Previously it was querying the found rows from the original MySQL select query to get the count. Now, it's running its own separate COUNT query.</p>

<p>Looking at the full MySQL statements above, in the first SELECT, createdDate for the secondary_table is defined <span style="text-decoration:underline;"><strong>AS</strong></span> secondary_table.createdDate, removing the ambiguity. In the second SELECT COUNT, it is not defining each secondary_table field AS, and this is likely the cause for the ambiguity.</p>
<p><em>function _getRecords_getQuery</em> includes // add fieldnames to SELECT resulting in the x AS y in the SELECT. (viewer_functions.php L398)</p>
<p><em>function _getRecords_getCountQuery</em> however doesn't include this full SELECT AS</p>
<p>Has SELECT FOUND_ROWS() been replaced by SELECT COUNT(*) for efficiency reasons?</p>
<p>FYI all line numbers in ^^ are based on CMSB v3.65.</p>]]></description>
          <pubDate>Fri, 29 Mar 2024 15:58:51 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247074#post2247074</guid>
        </item>
                <item>
          <title>LEFT JOIN + default orderBy = bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247073#post2247073</link>
          <description><![CDATA[<p>Hey Dave</p>
<blockquote>
<p>So is the SQL generated by the previous and current versions of CMSB the same?</p>
</blockquote>
<p>Correct, which makes me think as well that it's MySQL config related.</p>
<blockquote>
<p>And if so do you know if the MySQL/MariaDB might have been updated at the same time as you updated CMSB?</p>
</blockquote>
<p>MySQL instance is unchanged. MySQL is running in it's own docker container which is untouched by the CMSB upgrade.</p>
<blockquote>
<p>Do you know if you have a server that's using the same version of MySQL/MariaDB but on the older CMSB that's still working?  Or can you replicate the working condition on the same server with a temporary old cmsb install?  </p>
</blockquote>
<p>Yes, LEFT JOINS work correctly if I switch back to the old CMSB version. I have the CMSB upgrade on a new branch so easy to switch back, and with all other environmental factors the same:</p>
<p>Old CMSB codebase: LEFT JOINs work</p>
<p>New CMSB codebase: LEFT JOINs result in ambiguous ORDER BY</p>
<blockquote>
<p>I'm thinking either there's been some changes in MySQL/MariaDB that has them be more strict about requiring fully qualified table.column names in the ORDER BY for joins, or maybe some of the more stricter MySQL settings we're using are causing the error. </p>
</blockquote>
<p>I agree :-) I think it's more likely related to the stricter MySQL settings the new CMSB is using, as I've had no changes to my actual MySQL instance.</p>
<p>Are you able to replicate? If not, then I wonder if we need to compare MySQL server settings?</p>
<p>I'll do some more digging at my end too, but also happy to run some tests if you can point in whatever direction.</p>
<p>Cheers</p>
<p>Rob</p>]]></description>
          <pubDate>Fri, 29 Mar 2024 15:04:36 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247073#post2247073</guid>
        </item>
                <item>
          <title>LEFT JOIN + default orderBy = bug</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247063#post2247063</link>
          <description><![CDATA[<p>Hey</p>
<p>Very similar to this issue, <a href="https://www.interactivetools.com/forum/forum-posts.php?postNum=2246572" rel="nofollow">https://www.interactivetools.com/forum/forum-posts.php?postNum=2246572</a>, after upgrading to v3.66 all getRecords calls I have which include a LEFT JOIN throw a MySQL Error:</p>
<pre class="language-php"><code>MySQL Error(1052): Column 'createdDate' in order clause is ambiguous in...</code></pre>
<p>In this case, createdDate is the default ordering field as defined in the <strong>schema settings. </strong>The same occurs if the default order is left as dragSortOrder.</p>
<p><strong>This causes every getRecords which contains a leftJoin to error unless it has an explicit orderBy value defined at getRecords stage.</strong></p>
<pre class="language-markup"><code>list($records, $Metadata) = getRecords(array(
    'tableName'   =&gt; 'primary_table',
    'leftJoin'   =&gt; array(
        "secondary_table" =&gt; "ON (primary_table.link_field = secondary_table.num)",
    ),
));
</code></pre>
<p>By explicitly applying orderBy to the getRecords function resolves the issue:</p>
<pre class="language-markup"><code>list($records, $Metadata) = getRecords(array(
    'tableName'   =&gt; 'primary_table',
   'orderBy'     =&gt; 'primary_table.createdDate',
    'leftJoin'   =&gt; array(
        "secondary_table" =&gt; "ON (primary_table.link_field = secondary_table.num)",
    ),
));
</code></pre>
<p>It was not an issue in previous versions of CMSB.</p>
<p><span>Full debugSQL:</span></p>
<pre class="language-markup"><code>SELECT `primary_table`.*,
`secondary_table`.`num` AS `secondary_table.num`,
`secondary_table`.`createdDate` AS `secondary_table.createdDate`,
`secondary_table`.`name` AS `secondary_table.name`
FROM `primary_table` as `primary_table`
LEFT JOIN `secondary_table` AS `secondary_table` ON (primary_table.link_field = secondary_table.num)

 ORDER BY createdDate DESC</code></pre>
<p>The issue being</p>
<pre class="language-php"><code>ORDER BY createdDate DESC</code></pre>
<p>Because of the LEFT JOIN present, it needs to be fully qualified, e.g.:</p>
<pre class="language-php"><code>ORDER BY primary_table.createdDate DESC</code></pre>
<p><strong>Thinking about a solution:</strong></p>
<pre class="language-php"><code>function getRecords {
if (!array_key_exists('orderBy', $options)) { $options['orderBy'] = _getOrderByFromUrl($schema) ?? $schema['listPageOrder']; }
...</code></pre>
<p><strong>$schema['listPageOrder'] </strong>needs to be fully qualified IF a LEFT JOIN is present.</p>
<p>The only current workaround is to explicitly apply the fully qualified field in the getRecords call using 'orderBy' but this impacts 100s of places of legacy code (because it wasn't an issue with previous version of CMSB) so ideally would love to see if fixed at getRecords level :-)</p>
<p>On CMSB v3.57, the <em>ORDER BY createdDate DESC</em> generated by getRecords is the same, i.e. not fully qualified when using a LEFT JOIN, yet works, so not entirely sure what's causing this error.</p>
<p>Thanks</p>
<p>Rob</p>]]></description>
          <pubDate>Wed, 27 Mar 2024 16:05:04 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247063#post2247063</guid>
        </item>
                <item>
          <title>MySQL Error in v3.53 (Build 2265) for MySQL Version 8.0.19</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244642#post2244642</link>
          <description><![CDATA[<p>Hey</p>
<p>I'm running MySQL Version 8.0.19 and the background tasks menu was throwing a fatal MySQL error:</p>
<p>admin.php?menu=admin&amp;action=bgtasks</p>
<pre class="language-php"><code>Notice: MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'function = "{functionName}" ORDER BY num DESC LIMIT 1' at line 1 - in mysql_functions.php on line 210 by mysql_get_query() in /{path}/admin/lib/common.php on line 278</code></pre>
<p>This is caused by 'function' being a MySQL Reserved Word</p>
<p><strong>Fix:</strong></p>
<p>admin/lib/menus/admin/backgroundTasks.php</p>
<p>line 293</p>
<p>Was:</p>
<pre class="language-php"><code>$latestLog = mysql_get('_cron_log', null, ' function = "' .mysql_escape($record['function']). '" ORDER BY num DESC');</code></pre>
<p>Now:</p>
<pre class="language-php"><code>$latestLog = mysql_get('_cron_log', null, ' `function` = "' .mysql_escape($record['function']). '" ORDER BY num DESC');</code></pre>
<p>i.e. addition of backticks around <em>function</em></p>
<p>So effectively going from:</p>
<pre class="language-php"><code>SELECT * FROM `cmsb__cron_log` WHERE function = "{functionName}" ORDER BY num DESC LIMIT 1;</code></pre>
<p>to</p>
<pre class="language-php"><code>SELECT * FROM `cmsb__cron_log` WHERE 'function' = "{functionName}" ORDER BY num DESC LIMIT 1;</code></pre>

<p>Also need to apply the same fix to:</p>
<p>admin/cron.php</p>
<p>Line 108:</p>
<p>Was:</p>
<pre class="language-php"><code>  $jobLastLogRecord = mysql_get('_cron_log', null, ' function = "' .mysql_escape($cron['function']). '" ORDER BY num DESC');</code></pre>
<p>Now:</p>
<pre class="language-php"><code>$jobLastLogRecord = mysql_get('_cron_log', null, ' `function` = "' .mysql_escape($cron['function']). '" ORDER BY num DESC');
</code></pre>
<p><br />I've manually updated my file, but I thought I'd share here in case anyone else has the same issue, and it would be great if this could be patched in the next version.</p>
<p>Cheers</p>
<p>Rob</p>]]></description>
          <pubDate>Thu, 16 Apr 2020 09:54:15 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244642#post2244642</guid>
        </item>
              </channel>
    </rss>
  