Issue 1:
The TypeValidator seems to be useless whenever the value being validated is NULL. It completely ignores the type I've configured it to enforce.

After debugging this for quite some time, it turns out the issue lies in the following line(s) of code:

https://github.com/symfony/symfony/blob/2.4/src/Symfony/Component/Validator/Constraints/TypeValidator.php#L29

if (null === $value) {
return;
}

What is the reasoning behind this short-circuit logic?

If I configure my TypeValidator to enforce a value to be of type integer (or string, or whatever), then I expect it to throw a validation error whenever the value is not of the desired type... especially when it's NULL.

Allowing NULL to always be valid regardless of what type you've asked it to enforce seems to be counter-intuitive and leads to some unusual/unexpected validation behavior.

Coincidentally, I went through the history of this file and noticed that these very lines of code were once removed (2 years ago):

474b4ab

Why have they been reintroduced? Was this a merging oversight?

Issue 2:
Hello,

Q
A

Bug report?
yes

Feature request?
no

BC Break report?
no

RFC?
no

Symfony version
3.2.5

When trying to use the url matcher against a route that uses a condition it would crash if the condition is using the request object.

I pushed an example of the issue on this branch -> so that anyone can check. Going to /en/blog/ would produce the bug.

Here is an example of output using router:match command.

❯ bin/console router:match /en/blog/rss.xml -vv

[RuntimeException]
Unable to get a property on a non-object.

Exception trace:
() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php:83
Symfony\Component\ExpressionLanguage\Node\GetAttrNode->evaluate() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php:81
Symfony\Component\ExpressionLanguage\ExpressionLanguage->evaluate() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php:108
Symfony\Component\Routing\Matcher\TraceableUrlMatcher->matchCollection() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php:92
Symfony\Component\Routing\Matcher\UrlMatcher->match() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php:37
Symfony\Component\Routing\Matcher\TraceableUrlMatcher->getTraces() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php:95
Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand->execute() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:265
Symfony\Component\Console\Command\Command->run() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:852
Symfony\Component\Console\Application->doRunCommand() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:189
Symfony\Component\Console\Application->doRun() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/benoit/workspace/symfony_demo/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:120
Symfony\Component\Console\Application->run() at /home/benoit/workspace/symfony_demo/bin/console:29

To reproduce, add a condition like condition="request.isXmlHttpRequest()" on any route then try to call the url matcher on this route like $this->get('router')->match('<tested_route>').