Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

1305 FUNCTION [Datenbank].CHAR_LENGTH does not exist

More
7 years 5 months ago #3693 by Administrator AV
I just noticed the following bug in Visforms which only occurs on systems with mysql versions lower than 5.5 and
if the option "Result text" is set in the form configuration.

A user will then get an error 1305 FUNCTION [Datenbank].CHAR_LENGTH does not exist after the form was submitted.

The bug is due to an incompatible mysql statement. I will fix the bug with the next Visforms version. In the meantime you can try the following fix.

Open the file router.php in components/com_visforms.
In line 195 - 220 you find the following code
Code:
if (strpos($segment, ':') !== false) { $query = $db->getQuery(true); $query->select('CASE WHEN CHAR_LENGTH (name) THEN CONCAT_WS(":", id, name) ELSE id END as slug'); $query->from('#__visforms'); $db->setQuery($query); $slugs = $db->loadColumn(); if (!empty($slugs)) { foreach ($slugs as $slug) { if ($segment === $slug) { $form = explode(':', $segment); $vars['id'] = $form[0]; if ($count == 2) { $vars['view'] = 'message'; } continue; } } } //we should not arrive here }

Please replace it with:
Code:
if (strpos($segment, ':') !== false) { list($id, $name) = explode(':', $segment, 2); $query = $db->getQuery(true); //$query->select('CASE WHEN CHAR_LENGTH (name) THEN CONCAT_WS(":", id, name) ELSE id END as slug'); $query->select($db->quoteName( 'name')); $query->from('#__visforms'); $query->where($db->quoteName('id') . ' = ' . (int) $id); $db->setQuery($query); $slug = $db->loadColumn(); if (!empty($slug)) { if ($slug === $name) { $vars['id'] = $id; if ($count == 2) { $vars['view'] = 'message'; } } } //we should not arrive here }

Make a backup copy of the original file before you make the changes, just in case. Please let me know, if this fixes the problem.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
7 years 3 months ago - 7 years 3 months ago #3873 by HCDesign
Hallo , danke vorab für die tolle Erweiterung!

Ich hatte genau dieses Problem und mit dem Fix wurde das Problem fast beseitigt.
Ich habe noch einen kleinen Fehler gefunden welcher für eine Fehlerausgabe bei der Anzeige der Erfolgsnachricht geführt hat:

und zwar:
if ($slug === $name) konnte nicht funktionieren da $slug ein Array ist
if ($slug[0] === $name) hat für mich dann das Problem gelöst

Ich mir jetzt allerdings nicht sicher ob diese Lösung für alle gilt....
Last edit: 7 years 3 months ago by HCDesign.

More
7 years 3 months ago #3875 by Administrator AV
Replied by Administrator AV on topic 1305 FUNCTION [Datenbank].CHAR_LENGTH does not exist
Hallo,

danke!
Du hast absolut recht, in diesem Code hat sich ein Fehler eingeschlichen.
Ich hatte den Fix nach Visforms 3.8 übernommen und den Fehler dort mittlerweile auch entdeckt, und in Visforms 3.8.16 ist das gefixt. Ich hatte aber vergessen dies hier mitzuteilen (ist mir irgendwie durchgerutscht).

Der Fix ist folgender (ein paar Zeilen weiter oben).

Statt
$slug = $db->loadColumn();
muss es
$slug = $db->loadResult();
heißen, dann kann der folgende Code bleiben wie er ist.

Aber so wie du es gelöst hast sollte es auch immer funktionieren.

Liebe Grüße,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum