Skip to content

[Validator] Improved error message for missing upload_tmp_dir #21335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2017
Merged

[Validator] Improved error message for missing upload_tmp_dir #21335

merged 1 commit into from
Jan 21, 2017

Conversation

Breuls
Copy link
Contributor

@Breuls Breuls commented Jan 18, 2017

Q A
Branch? 2.7
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets N/A
License MIT
Doc PR N/A

I ran into a problem in which the value for upload_tmp_dir was set in php.ini, but PHP was unable to write to the specified location. PHP returns an UPLOAD_ERR_NO_TMP_DIR in $_FILES when it can't find or use the tmp dir, and my application displayed the error for $uploadNoTmpDirErrorMessage, from which I drew the conclusion that the ini setting was missing or emtpy.

This conclusion was based on the wording in the error message, which explicitly states that 'no temporary folder was configured', which is not actually correct. According to the PHP documentation:

UPLOAD_ERR_NO_TMP_DIR
Value: 6; Missing a temporary folder. Introduced in PHP 5.0.3.

'Missing' might be interpreted as 'the value for the ini setting is missing', but also as 'the configured folder is missing'.

I thought it might save someone some time if the error message from the Symfony Validator makes this explicit, which is what this PR aims to do.

I also updated the Dutch and Polish translations, because those, in addition to English, are the languages spoken in my team.

@@ -50,7 +50,7 @@ class File extends Constraint
public $uploadFormSizeErrorMessage = 'The file is too large.';
public $uploadPartialErrorMessage = 'The file was only partially uploaded.';
public $uploadNoFileErrorMessage = 'No file was uploaded.';
public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.';
public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini, or the configured folder does not exist.';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should stay the same. If we made the change here, this would be a BC break for everyone using their own translations. Instead, we can just change the target value in the validators.en.xml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't know that was a possibility.

I've updated the PR; only the language files for EN, NL and PL now have the change.

@javiereguiluz
Copy link
Member

👍

@xabbuh
Copy link
Member

xabbuh commented Jan 20, 2017

👍

@jakzal @iltar @wouterj Can you review the Polish and Dutch translations?

@linaori
Copy link
Contributor

linaori commented Jan 20, 2017

Current:

Er is geen tijdelijke map geconfigureerd in php.ini, of de geconfigureerde map
bestaat niet.

Proposal:

Er is geen tijdelijke folder geconfigureerd in php.ini, of de geconfigureerde folder
bestaat niet.

Not 100% sure about the original text. It's not wrong, but it feels a bit like google translate.

@Breuls
Copy link
Contributor Author

Breuls commented Jan 20, 2017

@iltar 'folder' isn't actually a Dutch word, so it seems odd to change 'map' to 'folder'.

@@ -192,7 +192,7 @@
</trans-unit>
<trans-unit id="51">
<source>No temporary folder was configured in php.ini.</source>
<target>Nie skonfigurowano folderu tymczasowego w php.ini.</target>
<target>Nie skonfigurowano folderu tymczasowego w php.ini, lub folder konfiguracji nie istnieje.</target>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nie skonfigurowano folderu tymczasowego w php.ini, lub skonfigurowany folder nie istnieje.

@linaori
Copy link
Contributor

linaori commented Jan 20, 2017

After a small discussion on slack in #dutch, we came up with this:

Er is geen tijdelijke map geconfigureerd in de php.ini, of de gespecifiëerde map bestaat niet.

@Breuls
Copy link
Contributor Author

Breuls commented Jan 20, 2017

Allright, that's fine. I'll make it "gespecificeerde" though, as "gespecifiëerde" also doesn't exist. ;)

@fabpot
Copy link
Member

fabpot commented Jan 20, 2017

@Breuls What about @jakzal suggestion for the Polish version?

@Breuls
Copy link
Contributor Author

Breuls commented Jan 21, 2017

@fabpot Sorry, missed that. I didn't write the original proposal, but I've updated it now.

@jakzal
Copy link
Contributor

jakzal commented Jan 21, 2017

👍

@fabpot
Copy link
Member

fabpot commented Jan 21, 2017

Thank you @Breuls.

@fabpot fabpot merged commit afbf227 into symfony:2.7 Jan 21, 2017
fabpot added a commit that referenced this pull request Jan 21, 2017
…p_dir (Breuls)

This PR was merged into the 2.7 branch.

Discussion
----------

[Validator] Improved error message for missing upload_tmp_dir

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

I ran into a problem in which the value for upload_tmp_dir was set in php.ini, but PHP was unable to write to the specified location. PHP returns an UPLOAD_ERR_NO_TMP_DIR in $_FILES when it can't find or use the tmp dir, and my application displayed the error for $uploadNoTmpDirErrorMessage, from which I drew the conclusion that the ini setting was missing or emtpy.

This conclusion was based on the wording in the error message, which explicitly states that 'no temporary folder was configured', which is not actually correct. According to the [PHP documentation](http://php.net/manual/en/features.file-upload.errors.php):

> UPLOAD_ERR_NO_TMP_DIR
> Value: 6; Missing a temporary folder. Introduced in PHP 5.0.3.

'Missing' might be interpreted as 'the value for the ini setting is missing', but also as 'the configured folder is missing'.

I thought it might save someone some time if the error message from the Symfony Validator makes this explicit, which is what this PR aims to do.

I also updated the Dutch and Polish translations, because those, in addition to English, are the languages spoken in my team.

Commits
-------

afbf227 [Validator] Improved error message for missing upload_tmp_dir
fabpot added a commit that referenced this pull request Jan 23, 2017
…alidation secti… (davewwww)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] add "mapping" configuration key at validation secti…

| Q | A |
| --- | --- |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #15655 |
| License | MIT |
| Doc PR | symfony/symfony-docs#7407 |

This feature allows you, to define additional validation files or directories which are not in the 'Bundle*/Resources/config/' directory.

``` yaml
#config.yml
framework:
  validation:
    mapping:
      paths:
        - "path/to/file/validation.yml"
        - "path/to/file/validation.xml"
        - "path/to/another/directory"
```

Commits
-------

d696cfb [FrameworkBundle] Configurable paths for validation files
60d7d43 fix merge
61475b5 Merge branch '3.2'
ba41e70 Merge branch '3.1' into 3.2
4268aba Merge branch '2.8' into 3.1
3faf655 Merge branch '2.7' into 2.8
e95fc09 fix getMock usage
482828c fix merge
ed5eb6d bug #21372 [DependencyInjection] Fixed variadic method parameter in autowired classes (brainexe)
a7f63de [DependencyInjection] Fixed variadic method parameter in autowired classes
9ef4271 minor #21371 [Validator] update German translation (xabbuh)
f920e61 update German translation
41c72ab minor #21335 [Validator] Improved error message for missing upload_tmp_dir (Breuls)
afbf227 [Validator] Improved error message for missing upload_tmp_dir
mweimerskirch added a commit to mweimerskirch/symfony that referenced this pull request Oct 28, 2017
nicolas-grekas pushed a commit that referenced this pull request Oct 28, 2017
nicolas-grekas added a commit that referenced this pull request Oct 28, 2017
…on (mweimerskirch)

This PR was submitted for the 3.3 branch but it was merged into the 2.7 branch instead (closes #24719).

Discussion
----------

Fixed a few spelling mistakes in Luxembourgish translation

Fixed a few spelling mistakes in Luxembourgish translation and also adjusted trans-unit "51" to commit #21335

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? |no
| Tests pass?   | yes
| License       | MIT

Commits
-------

7a81576 Fixed a few spelling mistakes in Luxembourgish translation
fabpot added a commit that referenced this pull request Mar 16, 2020
…gusz)

This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[Validator] Remove commas in translations

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| License       | MIT

These translations were originally modified in #21335.

Commits
-------

5688f97 [Validator] Remove commas in translations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants