PHP 4.3.3
Postgresql 7.3.4
Drupal 4.3.2
(using debian packages)

Where: Comment Viewing Options
What did I do: Clicked the "Save Settings" button.
Result: The following error....

warning: pg_exec(): Query failed: ERROR: pg_atoi: zero-length string
. in /usr/share/php/DB/pgsql.php on line 164.

user error: DB Error: unknown error

query: UPDATE users SET mode = '4', sort = '1', threshold = '', data = 'a:4:{s:5:\"block\";a:0:{}s:5:\"pass1\";s:0:\"\";s:5:\"pass2\";s:0:\"\";s:17:\"comments_per_page\";s:2:\"50\";}', timestamp = 1081938567 WHERE uid = 1 in /usr/share/drupal/includes/database.pear.inc on line 89.

warning: Cannot modify header information - headers already sent by (output started at /usr/share/drupal/includes/common.inc:63) in /usr/share/drupal/includes/common.inc on line 472.

Cheers,

Cliff

CommentFileSizeAuthor
#7 comment.module.4.3.2.diff418 bytescliffp
#4 comment_setting_error.diff959 bytesadrian

Comments

cliffp’s picture

I've just assigned a threshold of "everything", value 0. That gets around the problem. So, if it's a bug, as I believe it is, there's a workaround. .

I guess the code should assign a default value of "0" if there aren't any thresholds defined... but this **is** a back release...

Cheers,

Cliff

adrian’s picture

I think the correct procedure in this case would be to have the sql generated correctly.

This likely only works on mysql because the field restrictions aren't strict enough.

Anonymous’s picture

I am on Drupal 4.4.0 (and PostgreSQL) and have this problem too.

adrian’s picture

Assigned: Unassigned » vertice@www.drop.org
StatusFileSize
new959 bytes

I found out the problem was across all db's, postgres just had stricter validation on the threshold field (ie: not null)

The theme_comment_threshold was not returning a hidden field when moderation wasn't enabled, hence the form didn't recieve what it thought it did.

This is a 3 line patch to fix this for release

it applies cleanly to head.

dries’s picture

Committed to both the HEAD and the DRUPAL-4-4 branch. Thanks Adrian.

cliffp’s picture

Cool! Thanks Adrian. I'm presuming the patch is for 4.4.x? Will it fit on 4.3.2, do you know, off the top of your head? If not, I'll try to retrofit it for my own purposes.

Cheers,

Cliff

cliffp’s picture

StatusFileSize
new418 bytes

Here's a diff of my patched module against the original comments module. I don't know what the protocol for supplying patches, but this works on my Debian system with Drupal 4.3.2-2, for anyone that is interested.

Cheers,

Cliff

Anonymous’s picture