Closed martin-ct closed 11 years ago
How are you defining the rules? There is a specific structure you need to follow.
public $actsAs = array(
'Uploader.FileValidation' => array(
'name' => array(
'maxWidth' => 6000,
'maxHeight' => 6000,
'extension' => array('gif', 'jpg', 'png', 'jpeg'),
'type' => 'image',
'filesize' => 5242880,
'required' => true
)
)
);
What Uploader version are you running since it requires PHP 5.3 and you mentioned 5.2?
Yes I am running the latest version. Sorry I didn't noticed the requirement for php 5.3. I was developing on php 5.4.4 but I just tested the implementation on php 5.2 and found that error. I thought it could help. :)
Cool will look into.
I have the same issue with php 5.3.18. Validation works fine on the developement machine with php 5.4.16 I am running the latest Uploader version as well.
I can confirm same issue on 5.3.20
Interesting. Probably why I never saw it was because I test on 5.4. Will take a look this weekend.
Fixed.
On php version 5.2 and maybe also lower version I'm getting error " Cannot unset string offsets" in file "Model/Behavior/FileValidationBehavior.php". It happens because of incorrect operation with arrays/strings. For example if you run code like this
if (isset($setting['error'])) {
on string it returns true (because it will expect an integer value - line 278).Possible fix is on the line 256 at the beginning of the array with is_array() function:
if (!is_array($setting) || !isset($setting['value'])) { $setting = array('value' => $setting); }