You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so $this->t_ignore_prefix is not an array at the time array_merge() is called, not even an empty one.
I know this is just a warning and not an error, but reading the docs on array_merge, I see, among others, this comment:
$a = array(1,2,3); // an array
$b = 5; // anything but not an array
$c = array_merge($a, $b); // shows a PHP warning: Argument #2 is not an array
var_dump($c); // output as NULL
// now merge in reverse order
$d = array_merge($b, $a); // shows a PHP warning: Argument #1 is not an array
var_dump($d); // output as NULL
NOTE: For any operation that relies on the previous array merge operation it is highly necessary to check the arguments as well as the result of the merge are arrays before continuing as the warning would not stop the operation and this might result in data loss and what not... and this should also be stated in the .documentation. Example #3 somewhat started to demonstrate this but used type casting which made this irrelevant to this matter.
You may say, "in our case the result of merging the non-array $this->t_ignore_prefix with $t will still be OK", but relying on such effects is very obscure behavior to me.
Solution
Initialize all arrays to the empty array:
In the constructor of scrambler, at the top, where other $this properties are initialized, add:
I get
The line in question contains
$this->t_ignore_prefix = array_merge($this->t_ignore_prefix,$t);
so $this->t_ignore_prefix is not an array at the time array_merge() is called, not even an empty one.
I know this is just a warning and not an error, but reading the docs on array_merge, I see, among others, this comment:
You may say, "in our case the result of merging the non-array $this->t_ignore_prefix with $t will still be OK", but relying on such effects is very obscure behavior to me.
Solution
Initialize all arrays to the empty array:
In the constructor of scrambler, at the top, where other $this properties are initialized, add:
The text was updated successfully, but these errors were encountered: