silverstripe-framework/composer.json
Nick e456de11b0
Fix clobbering of the upload size validation (#10059)
* Fix clobbering of the upload size validation

When the validation is set here like this, it overrides validation which has already been setup with a simple '*' rule for the size based on PHP.

If you've defined in the sites yml config something like

    SilverStripe\Assets\Upload_Validator:
      default_max_file_size:
        '[image]': '2m'
        '*' : '1m'

then it will not be respected.

If you review SilverStripe\Assets\Upload_Validator and check the getAllowedMaxFileSize method, you'll see the sizing will be populated (if it hasn't been done before).

You can see it fail by;
- Setup a new SilverStripe site.
- Set your PHP to allow max post / max upload size of 10mb.
- Add the above config to your sites yml file and flush.
- In the CMS you'll be able to upload a 5MB file, when you shouldn't.

* Test that FileField will use size validation if defined

Couple of tests which prove a fix so the FileField and others will use the default_max_file_size setting

* Fix variable name in last commit

This is what happens when you refactor in the github window.
Fix the variable names. This will get squashed once merged.

* Updates the pr - white space and non deprecated method for byte conversion

Remove extra white space to appease the CS. Use the non deprecated method for memstring2bytes

* White space fixes for the phpcs

White space fixes for the phpcs

* Ensure that "memstring2bytes" can handle if an empty or value with no number is passed in

* DEP Bump assets constraint to ensure that change is also pulled in

---------

Co-authored-by: Guy Sartorelli <guy.sartorelli@silverstripe.com>
2024-01-08 15:49:41 +13:00

117 lines
3.7 KiB
JSON

{
"name": "silverstripe/framework",
"type": "silverstripe-vendormodule",
"description": "The SilverStripe framework",
"homepage": "http://silverstripe.org",
"license": "BSD-3-Clause",
"keywords": [
"silverstripe",
"framework"
],
"authors": [
{
"name": "SilverStripe",
"homepage": "http://silverstripe.com"
},
{
"name": "The SilverStripe Community",
"homepage": "http://silverstripe.org"
}
],
"bin": [
"sake"
],
"require": {
"php": "^8.1",
"composer/installers": "^2.2",
"guzzlehttp/guzzle": "^7.5.0",
"guzzlehttp/psr7": "^2.4.0",
"embed/embed": "^4.4.7",
"league/csv": "^9.8.0",
"m1/env": "^2.2.0",
"masterminds/html5": "^2.7.6",
"monolog/monolog": "^3.2.0",
"nikic/php-parser": "^4.15.0",
"psr/container": "^1.1 || ^2.0",
"psr/http-message": "^1",
"sebastian/diff": "^4.0",
"silverstripe/config": "^2",
"silverstripe/assets": "^2.2",
"silverstripe/vendor-plugin": "^2",
"sminnee/callbacklist": "^0.1.1",
"symfony/cache": "^6.1",
"symfony/config": "^6.1",
"symfony/dom-crawler": "^6.1",
"symfony/filesystem": "^6.1",
"symfony/mailer": "^6.1",
"symfony/mime": "^6.1",
"symfony/translation": "^6.1",
"symfony/yaml": "^6.1",
"ext-ctype": "*",
"ext-dom": "*",
"ext-hash": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-session": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xml": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"silverstripe/versioned": "^2",
"squizlabs/php_codesniffer": "^3.7"
},
"conflict": {
"egulias/email-validator": "^2",
"oscarotero/html-parser": "<0.1.7",
"symfony/process": "<5.3.7"
},
"provide": {
"psr/container-implementation": "1.0.0"
},
"extra": {
"expose": [
"client/images",
"client/styles"
]
},
"autoload": {
"psr-4": {
"SilverStripe\\Control\\": "src/Control/",
"SilverStripe\\Control\\Tests\\": "tests/php/Control/",
"SilverStripe\\Core\\": "src/Core/",
"SilverStripe\\Core\\Tests\\": "tests/php/Core/",
"SilverStripe\\Dev\\": "src/Dev/",
"SilverStripe\\Dev\\Tests\\": "tests/php/Dev/",
"SilverStripe\\Forms\\": "src/Forms/",
"SilverStripe\\Forms\\Tests\\": "tests/php/Forms/",
"SilverStripe\\i18n\\": "src/i18n/",
"SilverStripe\\i18n\\Tests\\": "tests/php/i18n/",
"SilverStripe\\Logging\\": "src/Logging/",
"SilverStripe\\Logging\\Tests\\": "tests/php/Logging/",
"SilverStripe\\ORM\\": "src/ORM/",
"SilverStripe\\ORM\\Tests\\": "tests/php/ORM/",
"SilverStripe\\Security\\": "src/Security/",
"SilverStripe\\Security\\Tests\\": "tests/php/Security/",
"SilverStripe\\View\\": "src/View/",
"SilverStripe\\View\\Tests\\": "tests/php/View/",
"SilverStripe\\Framework\\Tests\\Behaviour\\": "tests/behat/src/"
},
"files": [
"src/includes/constants.php"
]
},
"include-path": [
"thirdparty/"
],
"scripts": {
"lint": "phpcs src/ tests/php/ tests/behat/src/",
"lint-clean": "phpcbf src/ tests/php/ tests/behat/src/",
"php-peg": "php thirdparty/php-peg/cli.php src/View/SSTemplateParser.peg > src/View/SSTemplateParser.php"
},
"minimum-stability": "dev",
"prefer-stable": true
}