General ⇒ DVCS Info (Mercurial/CVS) :: Archives ⇒ latest snapshots :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexDVCS Info (Mercurial/CVS)

Archived ⇒ latest snapshots This topic is locked: you cannot edit posts or make replies.

Due a bug in few MySQL versions and due too many possible combination of database connection charset and database/table collation, upgrades from MySQL4.x to >= 4.1, upgrades to latest DragonflyCMS ... and many more, I felt forced to hold a new release to fix all those issues in once.

DJ found the solution and its in cvs already.

More infos for developers:
as you already know $userinfo['user_ip'] holds a packed version in binary format of the visitor ip. We used to apply a right padding '/' to avoid MySQL bugs but for today standards this wasn't the proper fix.
Few of us noticed this bug a while ago when, for example, poster ip was different then what apache logged.

Solution was to send the ip in HEX format, every RDBMS using any kind of connection, collation.... will properly convert the hexadecimal ip into binary format.
does hold the hexadecimal ip (not binary ip anymore) without the trailing '/'.

So far so good.

Required changes:
1) use $db->binary_safe instead of $db->escape_binary
2) remove single quotes from within the queries

<?php # before $ip = $db->escape_binary(Security::get_ip()).'/'; $db->sql_query("INSERT INTO table ip='$ip'"); # now $ip = $db->binary_safe(Security::get_ip()); $db->sql_query("INSERT INTO table ip=$ip"); # before $db->sql_query("INSERT INTO table ip='".$userinfo['user_ip']."'"); # now $db->sql_query("INSERT INTO table ip=".$userinfo['user_ip']);

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS

Good to know! I never noticed this even though I've read a few posts on mysql about it. Embarassed

j e r u v y a t y a h o o d o t c o m

Need help? Look here:
Need to chat? Look for me on

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Ubuntu7.10/Debian3.1 - 2.2.3/1.3.37 - 5.0.38/4.0.27 - 5.2.1/4.4.7 - CVS/9.1.2}

All times are UTC
Post new topic This topic is locked: you cannot edit posts or make replies. Forum IndexDVCS Info (Mercurial/CVS)
Page 1 of 1