Re: [Tiki-devel] Fwd: SQL Query Error
Phil Jollans <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Victor,
no problem with the delay, I am even slower.
I put in var_dump(PHP_INT_MAX) and var_dump($maxRecords) and got the values
int(9223372036854775807)
NULL
I have changed the statement to
$limit .= ', ' . ( is_null($maxRecords) || ( $maxRecords == -1 ) ?
PHP_INT_MAX : $maxRecords);
which prevents the error.
I don't know if the NULL value indicates some other problem in the code.
Phil
On 11-Jan-23 16:56, Victor Emanouilov via TikiWiki-devel wrote:
>
> Hi Phil,
>
> Thanks for the info and sorry for the delay. since last visit module
> uses the module rows preference to send to get_files method while the
> other occurrence uses -1, so it seems PHP_INT_MAX might be the
> culprit. Can you do a `var_dump(PHP_INT_MAX)` and send me the result?
>
> Thanks,
> Victor
>
> On 1/6/23 9:24 AM, Phil Jollans wrote:
>>
>> Hi Victor,
>>
>> there appear to be two versions of the stack trace.
>>
>> [1]
>> As Admin, in the sidebar:
>>
>> #0
>> D:\xampp\htdocs\tiki-25.0\modules\mod-func-since_last_visit_new.php(405):
>> FileGalLib->get_files()
>> #1 D:\xampp\htdocs\tiki-25.0\lib\modules\modlib.php(1152):
>> module_since_last_visit_new()
>> #2 D:\xampp\htdocs\tiki-25.0\tiki-modules.php(49):
>> ModLib->execute_module()
>> #3 D:\xampp\htdocs\tiki-25.0\lib\core\Tiki\Render\Lazy.php(23):
>> Smarty_Tiki->{closure}()
>> #4 [internal function]: Tiki_Render_Lazy->__toString()
>> #5
>> D:\xampp\htdocs\tiki-25.0\lib\smarty_tiki\function.modulelist.php(74):
>> preg_replace()
>> #6 [internal function]: {closure}()
>> #7
>> D:\xampp\htdocs\tiki-25.0\lib\smarty_tiki\function.modulelist.php(45):
>> array_map()
>> #8
>> D:\xampp\htdocs\tiki-25.0\temp\templates_c\en_classic^91178ba94490a4afd08fb8b90b3bdda662791886_0.file.layout_view.tpl.php(175):
>> smarty_function_modulelist()
>> #9
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123):
>> content_63aea36f9ef049_65723007()
>> #10
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114):
>> Smarty_Template_Resource_Base->getRenderedTemplateCode()
>> #11
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216):
>> Smarty_Template_Compiled->render()
>> #12
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(385):
>> Smarty_Internal_Template->render()
>> #13
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_runtime_inheritance.php(115):
>> Smarty_Internal_Template->_subTemplateRender()
>> #14
>> D:\xampp\htdocs\tiki-25.0\temp\templates_c\en_classic^48d9321411e20d6f1ba645a0825d55246078e004_0.file.tiki-show_page.tpl.php(54):
>> Smarty_Internal_Runtime_Inheritance->endChild()
>> #15
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123):
>> content_63aea36f63cc13_75600843()
>> #16
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114):
>> Smarty_Template_Resource_Base->getRenderedTemplateCode()
>> #17
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216):
>> Smarty_Template_Compiled->render()
>> #18
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(238):
>> Smarty_Internal_Template->render()
>> #19
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(134):
>> Smarty_Internal_TemplateBase->_execute()
>> #20 D:\xampp\htdocs\tiki-25.0\lib\init\smarty.php(464):
>> Smarty_Internal_TemplateBase->display()
>> #21 D:\xampp\htdocs\tiki-25.0\tiki-index.php(746):
>> Smarty_Tiki->display()
>>
>> [2]
>> For any user, at the end of a wiki-page
>>
>> #0
>> D:\xampp\htdocs\tiki-25.0\lib\smarty_tiki\function.attachments.php(159):
>> FileGalLib->get_files()
>> #1
>> D:\xampp\htdocs\tiki-25.0\temp\templates_c\en_classic^3b057a111f01efab5809a48c5c1f0754df1a2795_0.file.tiki-page_bar.tpl.php(275):
>> smarty_function_attachments()
>> #2
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123):
>> content_63aea371ab3727_42853320()
>> #3
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114):
>> Smarty_Template_Resource_Base->getRenderedTemplateCode()
>> #4
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216):
>> Smarty_Template_Compiled->render()
>> #5
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(385):
>> Smarty_Internal_Template->render()
>> #6
>> D:\xampp\htdocs\tiki-25.0\temp\templates_c\en_classic^48d9321411e20d6f1ba645a0825d55246078e004_0.file.tiki-show_page.tpl.php(407):
>> Smarty_Internal_Template->_subTemplateRender()
>> #7
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_runtime_inheritance.php(248):
>> Block_82905192863aea36f602797_65943185->callBlock()
>> #8
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_runtime_inheritance.php(184):
>> Smarty_Internal_Runtime_Inheritance->callBlock()
>> #9
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_runtime_inheritance.php(186):
>> Smarty_Internal_Runtime_Inheritance->process()
>> #10
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_runtime_inheritance.php(156):
>> Smarty_Internal_Runtime_Inheritance->process()
>> #11
>> D:\xampp\htdocs\tiki-25.0\temp\templates_c\en_classic^91178ba94490a4afd08fb8b90b3bdda662791886_0.file.layout_view.tpl.php(164):
>> Smarty_Internal_Runtime_Inheritance->instanceBlock()
>> #12
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123):
>> content_63aea36f9ef049_65723007()
>> #13
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114):
>> Smarty_Template_Resource_Base->getRenderedTemplateCode()
>> #14
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216):
>> Smarty_Template_Compiled->render()
>> #15
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(385):
>> Smarty_Internal_Template->render()
>> #16
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_runtime_inheritance.php(115):
>> Smarty_Internal_Template->_subTemplateRender()
>> #17
>> D:\xampp\htdocs\tiki-25.0\temp\templates_c\en_classic^48d9321411e20d6f1ba645a0825d55246078e004_0.file.tiki-show_page.tpl.php(54):
>> Smarty_Internal_Runtime_Inheritance->endChild()
>> #18
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123):
>> content_63aea36f63cc13_75600843()
>> #19
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114):
>> Smarty_Template_Resource_Base->getRenderedTemplateCode()
>> #20
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216):
>> Smarty_Template_Compiled->render()
>> #21
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(238):
>> Smarty_Internal_Template->render()
>> #22
>> D:\xampp\htdocs\tiki-25.0\vendor_bundled\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(134):
>> Smarty_Internal_TemplateBase->_execute()
>> #23 D:\xampp\htdocs\tiki-25.0\lib\init\smarty.php(464):
>> Smarty_Internal_TemplateBase->display()
>> #24 D:\xampp\htdocs\tiki-25.0\tiki-index.php(746): Smarty_Tiki->display()
>>
>> Thanks for your help,
>> Phil
>>
>>
>> On 03-Jan-23 14:52, Victor Emanouilov via TikiWiki-devel wrote:
>>>
>>> Hi Phil,
>>>
>>> It seems either PHP_INT_MAX is not defined in your platform (highly
>>> unlikely) or a page calls this method without setting maxRecords
>>> correctly. Can you add
>>> debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) before this line
>>> and send us the result, so we can see which page is calling the method?
>>>
>>> Thanks,
>>> Victor
>>>
>>> On 12/30/22 11:00 AM, Phil Jollans wrote:
>>>>
>>>> More about the same error.
>>>>
>>>> I have got past this problem by commenting out line 2735 in
>>>> filegallib.php
>>>>
>>>> $limit .= ', ' . ($maxRecords == -1 ? PHP_INT_MAX : $maxRecords);
>>>>
>>>> Phil
>>>>
>>>>
>>>>
>>>> -------- Forwarded Message --------
>>>> Subject: SQL Query Error
>>>> Date: Fri, 30 Dec 2022 09:48:43 +0100
>>>> From: Phil Jollans <[email protected]>
>>>> To: Tikiwiki developers <[email protected]>
>>>>
>>>>
>>>>
>>>> I am testing tiki 25.0 on a XAMPP before installing it on my server.
>>>>
>>>> I am getting the error
>>>>
>>>>
>>>> System error.
>>>>
>>>> The following error message was returned:
>>>>
>>>> *
>>>> You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
>>>> *
>>>>
>>>> *The query was:*
>>>>
>>>> *SELECT 0 as `isgal`, tf.`fileId` as `id`, tf.`galleryId` as
>>>> `parentId`, tf.`name`, tf.`description`, tf.`filesize` as `size`,
>>>> tf.`created`, tf.`filename`, tf.`filetype` as `type`, tf.`user` as
>>>> `creator`, tf.`author`, tf.`hits`, tf.`lastDownload`, tf.`votes`,
>>>> tf.`points`, tf.`path`, tf.`reference_url`, tf.`is_reference`,
>>>> tf.`hash`, tf.`search_data`, tf.`metadata`, tf.`lastModif` as
>>>> `lastModif`, tf.`lastModifUser` as `last_user`, tf.`lockedby`,
>>>> tf.`comment`, tf.`deleteAfter`, tf.`maxhits`, tf.`archiveId`,
>>>> tf.`ocr_state`, '' as `visible`, '' as `public`, tf.`fileId`,
>>>> tf.`galleryId`, tf.`filesize`, tf.`filetype`, tf.`user`,
>>>> tf.`lastModifUser`, 0 as `icon_fileId`, '' as `files` FROM
>>>> `tiki_files` as tf WHERE tf.`archiveId`=0 AND tf.`created` > ?
>>>> ORDER BY `isgal` desc, `created` desc LIMIT 0, *
>>>>
>>>> *Values:*
>>>>
>>>> 1. 1670774331
>>>>
>>>> *The built query was likely:*
>>>>
>>>> *SELECT 0 as `isgal`, tf.`fileId` as `id`, tf.`galleryId` as
>>>> `parentId`, tf.`name`, tf.`description`, tf.`filesize` as `size`,
>>>> tf.`created`, tf.`filename`, tf.`filetype` as `type`, tf.`user` as
>>>> `creator`, tf.`author`, tf.`hits`, tf.`lastDownload`, tf.`votes`,
>>>> tf.`points`, tf.`path`, tf.`reference_url`, tf.`is_reference`,
>>>> tf.`hash`, tf.`search_data`, tf.`metadata`, tf.`lastModif` as
>>>> `lastModif`, tf.`lastModifUser` as `last_user`, tf.`lockedby`,
>>>> tf.`comment`, tf.`deleteAfter`, tf.`maxhits`, tf.`archiveId`,
>>>> tf.`ocr_state`, '' as `visible`, '' as `public`, tf.`fileId`,
>>>> tf.`galleryId`, tf.`filesize`, tf.`filetype`, tf.`user`,
>>>> tf.`lastModifUser`, 0 as `icon_fileId`, '' as `files` FROM
>>>> `tiki_files` as tf WHERE tf.`archiveId`=0 AND tf.`created` >
>>>> '1670774331' ORDER BY `isgal` desc, `created` desc LIMIT 0, *
>>>>
>>>> Can anyone help me with this.
>>>>
>>>> It looks to me like the error is the trailing comma.
>>>>
>>>> If I remove the comma, I can execute the query in PhpMyAdmin.
>>>> With the comma, I get the exact same error.
>>>>
>>>> Phil
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> TikiWiki-devel mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>>>
>>>
>>> _______________________________________________
>>> TikiWiki-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>>
>>
>> _______________________________________________
>> TikiWiki-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>
>
> _______________________________________________
> TikiWiki-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
_______________________________________________
TikiWiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel