| @@ 650-654 (lines=5) @@ | ||
| 647 | // Handle the type constraint |
|
| 648 | switch (strtoupper($type)) { |
|
| 649 | case 'INT': |
|
| 650 | case 'INTEGER': |
|
| 651 | // Only use the first integer value |
|
| 652 | preg_match('/-?[0-9]+/', (string)$source, $matches); |
|
| 653 | $result = @ (int)$matches[0]; |
|
| 654 | break; |
|
| 655 | case 'FLOAT': |
|
| 656 | case 'DOUBLE': |
|
| 657 | // Only use the first floating point value |
|
| @@ 656-660 (lines=5) @@ | ||
| 653 | $result = @ (int)$matches[0]; |
|
| 654 | break; |
|
| 655 | case 'FLOAT': |
|
| 656 | case 'DOUBLE': |
|
| 657 | // Only use the first floating point value |
|
| 658 | preg_match('/-?[0-9]+(\.[0-9]+)?/', (string)$source, $matches); |
|
| 659 | $result = @ (float)$matches[0]; |
|
| 660 | break; |
|
| 661 | case 'BOOL': |
|
| 662 | case 'BOOLEAN': |
|
| 663 | $result = (bool)$source; |
|
| @@ 690-694 (lines=5) @@ | ||
| 687 | case 'ARRAY': |
|
| 688 | $result = (array)$source; |
|
| 689 | break; |
|
| 690 | case 'PATH': |
|
| 691 | $pattern = '/^[A-Za-z0-9_-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/'; |
|
| 692 | preg_match($pattern, (string)$source, $matches); |
|
| 693 | $result = @ (string)$matches[0]; |
|
| 694 | break; |
|
| 695 | case 'USERNAME': |
|
| 696 | $result = (string)preg_replace('/[\x00-\x1F\x7F<>"\'%&]/', '', $source); |
|
| 697 | break; |
|