Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] submitting a calendar event - bad timestamp type in SQL query [C-Chris]
#1
Ok, so I tried inserting the first event into my calendar:
MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
22P02 - ERROR: invalid input syntax for integer: "" 
Query:
INSERT INTO mybb_events (cid,uid,name,description,visible,private,dateline,starttime,endtime,timezone,ignoretimezone,usingtime,repeats) VALUES ('1','1','Klasówka z Mickiewicza','Klasówka z jęzka polskiego z życia i twórczości Adama Mickiewicza.','1','0','1228158352','1228867200','0','','0','0','N;')

I've checked the timestamp column type. It's integer. And digging into the code, I found it treated it as a string. The solution which worked for me is down here.

Suggested change to inc/datahandlers/event.php:
464c464
<                       'timezone' => $db->escape_string($event['timezone']),
---
>                       'timezone' => intval($event['timezone']),
MyBB 1.4.4
PHP: 5.2.6-pl7-gentoo
PostgreSQL 8.2.7
#2
Probably shouldn't occur under normal circumstances, since the select box should always have a number, but I agree that we shouldn't just assume a number is given.

Should use floatval instead of intval, since a decimal could be given, but then the column type for 'timezone' needs to be changed (note, setting a timezone which isn't an integer now, will stuff things up).
#3
Although integer != float. Would spit out an error if a comma was to be seen.
#4
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group


Forum Jump:


Users browsing this thread: 1 Guest(s)