Skip to content

MariaDB error 1292 #2075

Description

@Sneda8

Actual behaviour

When performing certain actions, such as editing articles, if the SQL UPDATE query contains COALESCE(FROM_UNIXTIME(0), FROM_UNIXTIME(1)), error 1292 is returned: Truncated incorrect unixtime value: '0.0'

Steps to reproduce

Update an article on MariaDB v12.*

Additional information

Textpattern version: 4.9.1

Database server vendor and version: 12.2.2-MariaDB-deb13

PHP version: 8.5.6

Proposed solution

Get completely rid of FROM_UNIXTIME(0)
I have replaced all COALESCE(FROM_UNIXTIME(0), FROM_UNIXTIME(1)) with FROM_UNIXTIME(1). This fixes the issue.

Quick fix (using bash)

Run this command in your textpattern directory:

find . -type f \( -name "*.php" \) \
-exec sed -i 's|COALESCE(FROM_UNIXTIME(0), FROM_UNIXTIME(1))|FROM_UNIXTIME(1)|g' {} +

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions