- Create getProgress/setProgress methods to replace getStep/setCurrent
- ProgressBar::setCurrent should auto-start the ProgressBar.
- You should be able to pass max to start
- getStepWidth is internal information that should not be public
- when verbosity set to quiet, the progress bar does not even need to
execute all the logic to generate output that is then thrown away
* 2.5: (33 commits)
[Validator] Added Swedish translations
[Validator] Fixed ExpressionValidator when the validation root is not an object
[Validator] Fixed: Made it possible (again) to pass a class name to Validator::validatePropertyValue()
Fix incorrect romanian plural translations
fix axes handling in Crawler::filterXPath()
fix some docblocks
Fixed self-reference in 'service_container' service breaks garbage collection (and clone).
[Process] Fix tests when pcntl is not available.
[DependencyInjection] Roll back changes made to generated files.
[Console] Roll back changes made to fixture files.
Issue #11489 Added some CA and ES translations
[Validator] Added more detailed inline documentation
[Validator] Removed information from the violation output if the value is an array, object or resource
partially reverted previous commit
fixed CS
Add point about ConsoleLogger to Console 2.5 changelog
[Validator] Fixed failing tests
[Validator] CS fixes
[FrameworkBundle] Made ConstraintValidatorFactory aware of the legacy validators
[Validator] Added extensive test coverage for the constraint validators for the different APIs
...
Conflicts:
src/Symfony/Component/Validator/Resources/translations/validators.ca.xlf
* 2.4: (24 commits)
[Validator] Added Swedish translations
Fix incorrect romanian plural translations
fix axes handling in Crawler::filterXPath()
fix some docblocks
Fixed self-reference in 'service_container' service breaks garbage collection (and clone).
[Process] Fix tests when pcntl is not available.
[DependencyInjection] Roll back changes made to generated files.
[Console] Roll back changes made to fixture files.
Issue #11489 Added some CA and ES translations
[Validator] Added more detailed inline documentation
[Validator] Removed information from the violation output if the value is an array, object or resource
partially reverted previous commit
fixed CS
properly handle null data when denormalizing
[Validator] Renamed valueToString() to formatValue(); added missing formatValue() calls
[Validator] Fixed CS
[Validator] Fixed date-to-string conversion tests to match ICU 51
[Validator] Added "{{ value }}" parameters where they were missing
[Validator] Simplified and explained the LuhnValidator
[Validator] Simplified IssnValidator
...
Conflicts:
src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php
src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php
src/Symfony/Component/Validator/Constraints/ChoiceValidator.php
src/Symfony/Component/Validator/Constraints/CollectionValidator.php
src/Symfony/Component/Validator/Constraints/FileValidator.php
src/Symfony/Component/Validator/Constraints/Isbn.php
src/Symfony/Component/Validator/Constraints/IsbnValidator.php
src/Symfony/Component/Validator/Constraints/LengthValidator.php
src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
src/Symfony/Component/Validator/Tests/Constraints/BlankValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/FalseValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/FileValidatorPathTest.php
src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/NullValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/TrueValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
This PR was merged into the 2.4 branch.
Discussion
----------
[Validator] Added Swedish translations
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | part of #11489
| License | MIT
Added some missing Swedish translations.
Should I make an additional PR to `master` for the `trans-unit id=78` ([ref](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf#L302))? Or should I add that in this PR?
Commits
-------
a361f10 [Validator] Added Swedish translations
This PR was squashed before being merged into the 2.5 branch (closes#11485).
Discussion
----------
[Validator] Constraint validators now use the 2.5 API
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
See the comments in #11049 for the origin of this PR.
Currently, the 2.5 API needs to use `LegacyExecutionContextFactory` because the constraint validators rely on methods from the old `ExecutionContext` class (like `validate()`, `validateValue()`). Consequently it is impossible to switch to the pure 2.5 API and check whether all calls to deprecated methods were removed from application code. This is fixed now.
This PR also introduces a complete test suite to test each constraint validator against all three APIs: 2.4, 2.5-BC and 2.5. Currently, some tests are not executed yet when running the complete test suite is run. I expect this to be fixed soon (ticket: sebastianbergmann/phpunit#529, pr: sebastianbergmann/phpunit#1327).
Commits
-------
295e5bb [Validator] Fixed failing tests
3bd6d80 [Validator] CS fixes
870a41a [FrameworkBundle] Made ConstraintValidatorFactory aware of the legacy validators
7504448 [Validator] Added extensive test coverage for the constraint validators for the different APIs
8e461af [Validator] Constraint validators now use the 2.5 API. For incompatible validators, legacy validators were created
This PR was merged into the 2.5 branch.
Discussion
----------
[Validator] Made it possible (again) to pass a class name to validatePropertyValue()
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11139
| License | MIT
| Doc PR | -
In the 2.4 API it was possible to do both:
```php
$validator->validatePropertyValue($object, 'propertyName', $myValue);
$validator->validatePropertyValue('\Vendor\Namespace\ClassName', 'propertyName', $myValue);
```
In the 2.5 API, the second case was not supported anymore. This is fixed now.
Together with the fix comes also a small change (also in the 2.4 API) which I'll demonstrate with a code snippet:
```php
$metadata->addPropertyConstraint('ClassName', 'propertyName', new Callback(
function ($value, $context) {
var_dump($context->getRoot());
var_dump($context->getPropertyPath());
}
));
$validator->validatePropertyValue('ClassName', 'propertyName', 'foobar');
```
Before this PR, the output would be:
```
string(9) "ClassName"
string(12) "propertyName"
```
This doesn't make a lot of sense, because usually the following condition holds during validation:
```php
'' === $context->getPropertyPath() || $value === $propertyAccessor->getValue($context->getRoot(), $context->getPropertyPath())
```
which obviously cannot work if root is a class name. Thus I changed the root and property path to become:
```
string(6) "foobar"
string(0) ""
```
With this change, the condition holds also in this case.
Commits
-------
2bf1b37 [Validator] Fixed ExpressionValidator when the validation root is not an object
ef6f5f5 [Validator] Fixed: Made it possible (again) to pass a class name to Validator::validatePropertyValue()
* 2.3: (22 commits)
Fix incorrect romanian plural translations
fix axes handling in Crawler::filterXPath()
fix some docblocks
Fixed self-reference in 'service_container' service breaks garbage collection (and clone).
[Process] Fix tests when pcntl is not available.
[DependencyInjection] Roll back changes made to generated files.
[Console] Roll back changes made to fixture files.
[Validator] Added more detailed inline documentation
[Validator] Removed information from the violation output if the value is an array, object or resource
partially reverted previous commit
fixed CS
properly handle null data when denormalizing
[Validator] Renamed valueToString() to formatValue(); added missing formatValue() calls
[Validator] Fixed CS
[Validator] Fixed date-to-string conversion tests to match ICU 51
[Validator] Added "{{ value }}" parameters where they were missing
[Validator] Simplified and explained the LuhnValidator
[Validator] Simplified IssnValidator
[Validator] Fixed and simplified IsbnValidator
[Validator] Simplified IBAN validation algorithm
...
Conflicts:
src/Symfony/Component/Console/Helper/DescriptorHelper.php
src/Symfony/Component/DependencyInjection/Container.php
src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
src/Symfony/Component/HttpFoundation/File/UploadedFile.php
src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php
src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
src/Symfony/Component/Validator/Constraints/CollectionValidator.php
src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php
src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php
This PR was merged into the 2.3 branch.
Discussion
----------
[Component][DomCrawler] fix axes handling in Crawler::filterXPath()
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11503
| License | MIT
| Doc PR |
Due to some limitations in the ``relativize()`` method, it was not possible to use XPath axes other than ``descendant`` or ``descendant-or-self`` in the ``filterXPath()`` method of the ``Crawler`` class. This commit adds support for the ``ancestor``, ``ancestor-or-self``, ``attribute``, ``child``, ``following``, ``following-sibling``, ``parent``, ``preceding``, ``preceding-sibling`` and ``self`` axes.
The only axis missing after this is the ``namespace`` axis. Filtering for namespace nodes returns ``DOMNameSpaceNode`` instances which can't be passed to the ``add()`` method.
Commits
-------
8dc322b fix axes handling in Crawler::filterXPath()
This PR was merged into the 2.6-dev branch.
Discussion
----------
[Validator] refs #11489 add some translations in french
| Q | A
| ------------- | ---
| Fixed tickets | part of #11489
| License | MIT
fixes some FR translations
Commits
-------
50791c6 [Validator] refs #11489 add some translations in french
Due to some limitations in the relativize() method, it was not
possible to use XPath axes other than descendant or descendant-or-self
in the filterXPath() method of the Crawler class. This commit adds
support for the ancestor, ancestor-or-self, attribute, child,
following, following-sibling, parent, preceding, preceding-sibling and
self axes.
This PR was merged into the 2.3 branch.
Discussion
----------
fix some docblocks
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
1775da5 fix some docblocks
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#11422).
Discussion
----------
[DependencyInjection] Self-referenced 'service_container' service breaks garbage collection
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Needs merge to | 2.4
| Fixed tickets | —
| License | MIT
| Doc PR | —
#### Problem
1. `Container::__construct()` sets the `service_container` service ID to a self-reference of `$this`.
1. This breaks PHP garbage collection (as well as `clone`).
#### Background
* As explained in [Reference Counting Basics](http://php.net/manual/en/features.gc.refcounting-basics.php), PHP is not able to destruct and garbage collect variables that contain a reference to itself, because the `refcount` is always > 0.
#### Example Use-Case
A precompiled container that is cloned for multiple tests (because `::compile()` can be slow).
```php
$precompiled = new ContainerBuilder();
// ...
$precompiled->compile();
foreach ($precompiled->getServiceIds() as $id) {
if ($precompiled->initialized($id)) {
$precompiled->set($id, null);
}
}
$precompiled_clean = clone $precompiled;
$precompiled = NULL;
// ...
foreach ($tests as $test) {
$container = clone $precompiled_clean;
// Required without this PR:
$container->set('service_container', $container);
// ...
}
```
* **Actual result [master]:**
All references to the original `$precompiled` container are not destructed and cleaned up, because `$precompiled` still references itself, which can cause terribly hard to debug defects due to stale reference pointers in memory (especially with `ContainerAware` services, or things like e.g. PDO connections), as well as high memory consumption, etc.
* **Expected result [PR]:**
No references to `$precompiled` are left; everything is shut down, cleaned up, and garbage-collected upon `$precompiled = NULL;`
#### Proposed solution
1. Hard-code a special behavior for the service ID `service_container`.
1. Remove the self-reference.
1. For now (until next major release), ensure that all `Container` methods work identically to before — instead of throwing exceptions when e.g. trying to set `service_container` to something that isn't `$this`… (which is technically possible right now, but the operation doesn't remotely make sense)
#### API changes
Per (3) above, this PR is backwards-compatible. However, for the sake of full disclosure, users may experience the following super-micro changes compared to HEAD:
1. The following method no longer exists in a dumped Container, because it is no longer a registered service:
```php
protected function getServiceContainerService()
{
throw new RuntimeException('You have requested a synthetic service ("service_container"). The DIC does not know how to construct this service.');
}
```
But given the exception, you weren't able to call it anyway.
1. The order/position of `service_container` in the array returned by `Container::getServiceIds()` may be different.
But that array has no particular order to begin with.
(Only the component's own unit tests are expecting an identical result at times, which is why I added the hard-coded ID via `$id[]` last, instead of initializing it first with `$id` already.)
1. `$container->set('service_container', $not_the_container);` no longer works.
Commits
-------
440322e Fixed self-reference in 'service_container' service breaks garbage collection (and clone).
This PR was merged into the 2.3 branch.
Discussion
----------
[Process] Fix tests when pcntl is not available.
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
It's solved the same way in the [AbstractProcessTest](3b837dc5c1/src/Symfony/Component/Process/Tests/AbstractProcessTest.php (L602-L603)).
Commits
-------
e40f24f [Process] Fix tests when pcntl is not available.
This PR was merged into the 2.4 branch.
Discussion
----------
Issue #11489 Added some CA and ES translations
* Added some translations in CA
* Fixed some translations in ES
Commits
-------
67a6b75 Issue #11489 Added some CA and ES translations
This PR was merged into the 2.6-dev branch.
Discussion
----------
Issue #11489 Translated 78 in Català
Just 78 is created because 73 to 77 are in another PR to branch 2.4.
Commits
-------
88eac04 Issue #11532 Translated 78 in Català
This PR was merged into the 2.6-dev branch.
Discussion
----------
[HttpKernel][FrameworkBundle] Replaced ESI mentions with SSI when appropriate
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
7ee23c1 Replaced ESI mentions with SSI when appropriate
This PR was merged into the 2.3 branch.
Discussion
----------
Make builds green again
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR rolls back changes made to the fixture and generated files in e9022adaef (#11512).
Commits
-------
88b4e70 [DependencyInjection] Roll back changes made to generated files.
f89811d [Console] Roll back changes made to fixture files.
This PR was merged into the 2.3 branch.
Discussion
----------
[Serializer] properly handle null data when denormalizing
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #10794
| License | MIT
| Doc PR |
Commits
-------
123fc62 properly handle null data when denormalizing
This PR was merged into the 2.6-dev branch.
Discussion
----------
[Validator] German translation for empty file errors
| Q | A
| ------------- | ---
| Fixed tickets | part of #11489
| License | MIT
Commits
-------
412f04f [Validator] German translation for empty file errors
This PR was merged into the 2.6-dev branch.
Discussion
----------
This files have an invalid namespace
| Q | A
| ------------------ | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | no
| License | MIT
* These namespaces do not match the files according to PSR-0 rules
* Used php-cs-fixer
Commits
-------
e238637 This files have an invalid namespace
This PR was merged into the 2.3 branch.
Discussion
----------
[Validator] Fixed string conversion in constraint violations
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #10675
| License | MIT
| Doc PR | -
Commits
-------
32ae95b [Validator] Added more detailed inline documentation
08ea6d3 [Validator] Removed information from the violation output if the value is an array, object or resource
d6a783f [Validator] Renamed valueToString() to formatValue(); added missing formatValue() calls
71897d7 [Validator] Fixed CS
cea4155 [Validator] Fixed date-to-string conversion tests to match ICU 51
5aa7e6d [Validator] Added "{{ value }}" parameters where they were missing
f329552 [Validator] Simplified and explained the LuhnValidator
bff09f2 [Validator] Simplified IssnValidator
224e70f [Validator] Fixed and simplified IsbnValidator
fd58870 [Validator] Simplified IBAN validation algorithm
97243bc [Validator] Fixed value-to-string conversion in constraint violations
75e8815 [Validator] Fix constraint violation message parameterization
This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes#11507).
Discussion
----------
Add point about ConsoleLogger to Console 2.5 changelog
Commits
-------
8744826 Add point about ConsoleLogger to Console 2.5 changelog
This PR was merged into the 2.5 branch.
Discussion
----------
[Validator] prevent unnecessary calls inside ExecutionContext
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
Small performance improvement by preventing calls to `PropertyPath::append($this->propertyPath, $subPath)` when not needed.
Commits
-------
d6d462a [Validator] do not call getter inside ExecutionContext to prevent unnecessary calls