Hi,
I'm using Unigueness
validation with two fields and a custom message:
public function validation()
{
$this->validate(new Uniqueness(array(
'field' => array('email', 'name'),
'message' => 'Some custom message'
)));
}
But PHP raises a Notice for strstr
function as follow:
**Notice:** Array to string conversion in /var/....
It seems there is bug in source uniqueness.zep
line 212
:
link Source Here
/*
* Check if the developer has defined a custom message
*/
let message = this->getOption("message");
let replacePairs = [":field": field];
if empty message {
if typeof field == "array" {
let replacePairs = [":fields": join(", ", field)];
let message = "Value of fields: :fields are already present in another record";
} else {
let message = "Value of field: ':field' is already present in another record";
}
}
/*
* Append the message to the validator
*/
this->appendMessage(strtr(message, replacePairs), field, "Unique");
I think typeof field
should be checked in first replacePairs
declaration or use if/else
condition to support that situation.
Thanks.