KD2 Framework  Check-in [47ea31c421]

Overview
Comment:Form: fix issue with max/min and strings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 7.3
Files: files | file ages | folders
SHA1: 47ea31c421cda913a1c7a40c3b10e632d43b8d45
User & Date: bohwaz on 2020-10-09 10:36:06
Other Links: branch diff | manifest | tags
Context
2020-10-13
15:52
AbstractEntity: fix issue with cloning check-in: 4f2dd08250 user: bohwaz tags: 7.3
2020-10-09
10:36
Form: fix issue with max/min and strings check-in: 47ea31c421 user: bohwaz tags: 7.3
2020-10-03
22:54
Entities: fix issues with saving modified entities check-in: 9492f88c2c user: bohwaz tags: 7.3
Changes

Modified src/lib/KD2/Form.php from [9529240965] to [bba35f434e].

458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
			case 'json':
				return json_decode($value) !== null;
			case 'lt':
				return isset($params[0]) && isset($source[$params[0]]) && $value < $source[$params[0]];
			case 'lte':
				return isset($params[0]) && isset($source[$params[0]]) && $value <= $source[$params[0]];
			case 'max':
				$size = is_array($value) ? count($value) : (is_numeric($value) ? $value : strlen($value));
				return isset($params[0]) && $size <= $params[0];
			case 'min':
				$size = is_array($value) ? count($value) : (is_numeric($value) ? $value : strlen($value));
				return isset($params[0]) && $size >= $params[0];
			case 'not_in':
				return !in_array($value, $params);
			case 'numeric':
				return is_numeric($value);
			case 'present':
				return isset($source[$key]);







|


|







458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
			case 'json':
				return json_decode($value) !== null;
			case 'lt':
				return isset($params[0]) && isset($source[$params[0]]) && $value < $source[$params[0]];
			case 'lte':
				return isset($params[0]) && isset($source[$params[0]]) && $value <= $source[$params[0]];
			case 'max':
				$size = is_array($value) ? count($value) : (isset($rules['string']) ? strlen($value) : $value);
				return isset($params[0]) && $size <= $params[0];
			case 'min':
				$size = is_array($value) ? count($value) : (isset($rules['string']) ? strlen($value) : $value);
				return isset($params[0]) && $size >= $params[0];
			case 'not_in':
				return !in_array($value, $params);
			case 'numeric':
				return is_numeric($value);
			case 'present':
				return isset($source[$key]);