View Single Post
Old 01-25-2006, 08:25 AM   #3
sealless
Green Mole
 
Join Date: Jan 2006
Posts: 3
Talking

First some more clarification:

The remote system where everything was working:

php 4.3.11
MySQL 4.1.14

Now as to the source of the problem : admin/robot_functions.php,
function phpdigGetSiteFromUrl

Code:
    if ($pu['port'] == 0 || $pu['port'] == 80) {
         $pu['port'] = '';
    }
    else {
         settype($pu['port'],'integer');
    }
Seems harmless enough. But eventually $pu['port'] gets used in this query

Code:
$query = "INSERT INTO ".PHPDIG_DB_PREFIX."sites SET site_url='$url',upddate=NOW(),username='".$pu['user']."',password='".$pu['pass']."',port='".$pu['port']."'";
Field port in the sites table is defined as smallint and when you try to executed this query in MySQL 5 you get this message

Quote:
#1366 - Incorrect integer value: '' for column 'port' at row 1
In MySQL4 the row is inserted with a value of zero for the port, no questions asked. That's why it worked on my remote host but not on my local PC. I would presume this is a "bug" but it could also just be some MySQL configuration issue that can be resolved without a change to the code. In my case I am going to make this quick and dirty change

Code:
    if ($pu['port'] == 0 || $pu['port'] == 80) {
         $pu['port'] = 0;
    }
    else {
         settype($pu['port'],'integer');
    }
to get by.
sealless is offline   Reply With Quote