I installed the captcha module, from here - github.com/kohana/captcha , but the error all the time pops up:

ErrorException [ Notice ]: Array to string conversion SYSPATH\classes\kohana\arr.php [ 436 ] 431 $result[$key] = Arr::merge($result[$key], $val); 432 } 433 else 434 { 435 // Find the values that are not already present 436 $diff = array_diff($val, $result[$key]); 437 438 // Indexed arrays are merged to prevent duplicates 439 $result[$key] = array_merge($result[$key], $diff); 440 } 441 } 

I can print dumps of arrays if this somehow helps to identify the problem, but in general, judging by what is said (Array to string conversation), the array cannot be converted to a string.

UPD (it looks scary, do not worry that a lot of text, these are ordinary arrays): I post a dump of arrays:

 var_dump($val) 

-> result:

 array(1) { [0]=> string(15) "DejaVuSerif.ttf" } array(48) { [0]=> string(2) "cd" [1]=> string(2) "tv" [2]=> string(2) "it" [3]=> string(2) "to" [4]=> string(2) "be" [5]=> string(2) "or" [6]=> string(3) "sun" [7]=> string(3) "car" [8]=> string(3) "dog" [9]=> string(3) "bed" [10]=> string(3) "kid" [11]=> string(3) "egg" [12]=> string(4) "bike" [13]=> string(4) "tree" [14]=> string(4) "bath" [15]=> string(4) "roof" [16]=> string(4) "road" [17]=> string(4) "hair" [18]=> string(5) "hello" [19]=> string(5) "world" [20]=> string(5) "earth" [21]=> string(5) "beard" [22]=> string(5) "chess" [23]=> string(5) "water" [24]=> string(6) "barber" [25]=> string(6) "bakery" [26]=> string(6) "banana" [27]=> string(6) "market" [28]=> string(6) "purple" [29]=> string(6) "writer" [30]=> string(7) "america" [31]=> string(7) "release" [32]=> string(7) "playing" [33]=> string(7) "working" [34]=> string(7) "foreign" [35]=> string(7) "general" [36]=> string(8) "aircraft" [37]=> string(8) "computer" [38]=> string(8) "laughter" [39]=> string(8) "alphabet" [40]=> string(8) "kangaroo" [41]=> string(8) "spelling" [42]=> string(9) "architect" [43]=> string(9) "president" [44]=> string(9) "cockroach" [45]=> string(9) "encounter" [46]=> string(9) "terrorism" [47]=> string(9) "cylinders" } array(6) { [0]=> array(2) { [0]=> string(29) "Do you hate spam? (yes or no)" [1]=> string(3) "yes" } [1]=> array(2) { [0]=> string(28) "Are you a robot? (yes or no)" [1]=> string(2) "no" } [2]=> array(2) { [0]=> string(24) "Fire is... (hot or cold)" [1]=> string(3) "hot" } [3]=> array(2) { [0]=> string(27) "The season after fall is..." [1]=> string(6) "winter" } [4]=> array(2) { [0]=> string(34) "Which day of the week is it today?" [1]=> string(6) "Friday" } [5]=> array(2) { [0]=> string(34) "Which month of the year are we in?" [1]=> string(3) "May" } } 

+

 var_dump($key) 

-> result:

 string(5) "fonts" string(5) "words" string(7) "riddles" 

+

 var_dump($result[$key]); 

-> result:

 array(1) { [0]=> string(15) "DejaVuSerif.ttf" } array(48) { [0]=> string(2) "cd" [1]=> string(2) "tv" [2]=> string(2) "it" [3]=> string(2) "to" [4]=> string(2) "be" [5]=> string(2) "or" [6]=> string(3) "sun" [7]=> string(3) "car" [8]=> string(3) "dog" [9]=> string(3) "bed" [10]=> string(3) "kid" [11]=> string(3) "egg" [12]=> string(4) "bike" [13]=> string(4) "tree" [14]=> string(4) "bath" [15]=> string(4) "roof" [16]=> string(4) "road" [17]=> string(4) "hair" [18]=> string(5) "hello" [19]=> string(5) "world" [20]=> string(5) "earth" [21]=> string(5) "beard" [22]=> string(5) "chess" [23]=> string(5) "water" [24]=> string(6) "barber" [25]=> string(6) "bakery" [26]=> string(6) "banana" [27]=> string(6) "market" [28]=> string(6) "purple" [29]=> string(6) "writer" [30]=> string(7) "america" [31]=> string(7) "release" [32]=> string(7) "playing" [33]=> string(7) "working" [34]=> string(7) "foreign" [35]=> string(7) "general" [36]=> string(8) "aircraft" [37]=> string(8) "computer" [38]=> string(8) "laughter" [39]=> string(8) "alphabet" [40]=> string(8) "kangaroo" [41]=> string(8) "spelling" [42]=> string(9) "architect" [43]=> string(9) "president" [44]=> string(9) "cockroach" [45]=> string(9) "encounter" [46]=> string(9) "terrorism" [47]=> string(9) "cylinders" } array(6) { [0]=> array(2) { [0]=> string(29) "Do you hate spam? (yes or no)" [1]=> string(3) "yes" } [1]=> array(2) { [0]=> string(28) "Are you a robot? (yes or no)" [1]=> string(2) "no" } [2]=> array(2) { [0]=> string(24) "Fire is... (hot or cold)" [1]=> string(3) "hot" } [3]=> array(2) { [0]=> string(27) "The season after fall is..." [1]=> string(6) "winter" } [4]=> array(2) { [0]=> string(34) "Which day of the week is it today?" [1]=> string(6) "Friday" } [5]=> array(2) { [0]=> string(34) "Which month of the year are we in?" [1]=> string(3) "May" } } 
  • From the error text it follows that one of the arrays $val or $result[$key] contains a value that cannot be converted to a string, and array_diff compares the string values ​​of the elements of the arrays. - ReinRaus
  • This is what is called "find not a string". - Smash
  • In my opinion here are one lines. - Smash
  • and what version of kohana? - kemerov4anin 5:41 pm
  • last one. - Smash

1 answer 1

A similar error with captcha on version 3.2. Swears at line number 87 $ captcha = Captcha :: instance ();

  ErrorException [ Notice ]: Array to string conversion SYSPATH\classes\kohana\arr.php [ 436 ] 431 $result[$key] = Arr::merge($result[$key], $val); 432 } 433 else 434 { 435 // Find the values that are not already present 436 $diff = array_diff($val, $result[$key]); 437 438 // Indexed arrays are merged to prevent duplicates 439 $result[$key] = array_merge($result[$key], $diff); 440 } 441 } 

I solved the problem by correcting the last array on the config file captcha.

 'riddles' => array ( 'Do you hate spam? (yes or no)' => 'yes', 'Are you a robot? (yes or no)' => 'no', ), 

Kokhana for some reason did not accept the initial array. And this one passes. But in the end, only basic, alpha, word work