cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG]: "Invalid parameter number" error when trying to reuse named parameter in Model::find

Open SliceOfLife opened this issue 3 years ago • 2 comments

Describe the bug We can't use one named parameter several times in find() and findFirst() functions because of "Invalid parameter number" error happens.

To Reproduce Steps to reproduce the behavior: We just need to build an SQL command with multiple uses of the same parameter.

		$sql = '(:login: IS NOT NULL AND login = :login: AND loginType = :login_type:)';
		$bind = [
			'login' => 'some-login-value',
			'login_type' => 'some-login-type',
		];
		$params = [$sql, ['bind' => $bind]];
		$user = User::findFirst($params);

Expected behavior I expect to use a named parameter as many times as I want in a single SQL command. But instead, I need to rename each use of the parameter to a numbered one, like "login_1", "login_2", etc.

Details

  • Phalcon version: 5.0.4
  • PHP Version: 8.1.14
  • Operating System: Docker
  • Installation type: Compiling from source https://github.com/phalcon/cphalcon/archive/v5.0.4.tar.gz
  • Zephir version (if any):
  • Server: Nginx
  • Other related info (Database, table schema): MariaDB

SliceOfLife avatar Jan 17 '23 20:01 SliceOfLife

@SliceOfLife look here https://github.com/phalcon/cphalcon/issues/16091

sinbadxiii avatar Jan 28 '23 11:01 sinbadxiii

@SliceOfLife look here #16091

Yes. thank you. Current issue is a duplicate of #16091 and #15810

SliceOfLife avatar Jan 31 '23 07:01 SliceOfLife