0 users online. Create an account or sign in to join them.Users

Announcement

Symphony's issue tracker has been moved to Github.

Issues are displayed here for reference only and cannot be created or edited.

Browse

Closed#124: Extension not installing due to locale floatval problem

I’ve discussed this issue also here on the forum: http://www.getsymphony.com/community/discussions/27336/2/#position-33

Apparently, when the machine that is hosting Symphony is set to have a european format for dates and numbers (typically, commas instead of dots), MySQL prints this in the log file:

512 - MySQL Error (1136): Column count doesn't match value count at row 1 in query "INSERT INTO `sym_extensions` VALUES (NULL, 'datetime', 'enabled', 1,2)"

As you can see, the comma in the version number makes MySQL believe that the arguments passed to the INSERT instruction are five instead of four.

The problem resides at line 151 in the class.extensionmanger.php file; a simple fix would be to rewrite that instruction this way:

$sql = "INSERT INTO `sym_extensions` VALUES (NULL, '$name', '".($enable ? 'enabled' : 'disabled')."', ".str_replace("," , ".", floatval($info['version'])).")";

Nevertheless, a more elegant way of solving this error would be to make the floatval function not be dependable on the locale machine settings, but always using english locale as default.

Maybe this problem could be fixed together with the version number problem: http://github.com/symphony/symphony-2/issues#issue/121

Would adding single quotes around the value fix this, allowing MySQL to interpret?

I think the version number should not be saved as float but as string (the database also needs adjustment in this case). That way the problem of this thread would not occur and the problem with truncated version numbers would be solved, too.

But would we then lose the ability to use the version compare functions in PHP, when the version numbers are not numeric?

No. For the first time we could really make use of it:

The function first replaces _, - and + with a dot . in the version strings and also inserts dots . before and after any non number so that for example ‘4.3.2RC1’ becomes ‘4.3.2.RC.1’. Then it splits the results like if you were using explode(‘.’, $ver). Then it compares the parts starting from left to right. If a part contains special version strings these are handled in the following order: any string not found in this list < dev < alpha = a < beta = b < RC = rc < # < pl = p. This way not only versions with different levels like ‘4.1’ and ‘4.1.2’ can be compared but also any PHP specific version containing development state.

http://de.php.net/manual/en/function.version-compare.php

In which case yes, totally for this :-)

Nice. I’ll make the necessary changes.

This issue is closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.1
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details