I have a class:
class Validator {
private $validationArray;
private $cleanedValues;
public function __construct($arg1, $arg2=NULL) {
if(empty($arg2)) {
$this->LoadValidatorByName($arg1);
} else {
$this->LoadValidatorFromLeadType($arg1, $arg2);
}
}
private function LoadValidatorFromLeadType($lead_type, $vocabulary) {
$ErrorReporter = new ErrorReporter;
$taxonomy_term = reset(taxonomy_get_term_by_name($lead_type, $vocabulary));
...some more stuff
The function taxonomy_get_term_by_name is a Drupal function but the issue I am experiencing is a PHP one.
When this method is called PHP complains with:
Strict warning: Only variables should be passed by reference in Validator->LoadValidatorFromLeadType() (line 32 of [path to my file])
Line 32 is ths line with:
$taxonomy_term = reset(taxonomy_get_term_by_name($lead_type, $vocabulary));
I've looked in to the error and I'm pretty sure I know what it means, but I can't understand what is wrong with my code that causes this warning.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…