Skip to content

[BUG]: Phalcon removes "not" if column name starts with "not" #17087

@kgrammer

Description

@kgrammer

I have a table that has a columns named 'notification_sent' and 'notification_hours'. These columns are defined as a "int unsigned NOT NULL DEFAULT '0'". I an trying to execute a simple count of records as follows:

$cnt = Travel::count(array('conditions' => 'notification_sent=1'));

This produces the following error:

Uncaught Phalcon\Mvc\Model\Exception: Column 'ification_sent' doesn't belong to any of the selected models (1), when preparing: SELECT COUNT(*) AS rowcount FROM [Travel] WHERE notification_sent=1

Phalcon is removing the "not" part of the column name, leaving the "ification_sent=1" as the column name.

This also happens for the 'notification_hours' column where Phalcon is removing the "not" and leaving 'ification_hours'.

To reproduce this behavior, simply create a table with a column name that starts with "not" and try to count the table entries where that column name is a specific value.

  • Phalcon version: 5.9.3 but I was asked to open an issue for Phalcon 6 since the bug would be addressed in V6.
  • PHP Version: 8.4.12
  • Operating System: Ubuntu 24.04.3 LTS
  • Server: Apache 4.4.65
  • Database: MySQL 8.0.43

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: mediumMedium

Type

No fields configured for Bug.

Projects

Status
Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions