Commit Graph

15513 Commits

Author SHA1 Message Date
Fabien Potencier
803d434839 merged branch jakzal/domcrawler-xpath-namespace-fix (PR #9129)
This PR was merged into the master branch.

Discussion
----------

[DomCrawler] Fixed an issue with namespace prefix matching being to greedy

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9121
| License       | MIT
| Doc PR        | -

The regexp matching prefixes is naive and matches most of strings followed by a colon: `/(?P<prefix>[a-z_][a-z_0-9\-\.]*):[^"\/]/i`.

It is also incomplete as it does not match all the supported characters (like the unicode ones). Implementing [the actual specification](http://www.w3.org/TR/2004/REC-xml-names11-20040204/#NT-PrefixedName) would mean creating a very complex expression, especially because we have to ignore strings contained in quotes etc.

This would match any XML tag name (names in quotes not ignored):

```php
$ncNameStartChar = 'a-z_\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\x{2FF}\\x{370}-\\x{37D}\\x{37F}-\\x{1FFF}\\x{200C}-\\x{200D}\\x{2070}-\\x{218F}\\x{2C00}-\\x{2FEF}\\x{3001}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFFD}\\x{10000}-\\x{EFFFF}';
$ncNameChar = $ncNameStartChar.'.\\-0-9\\xB7\\x{0300}-\\x{036F}\\x{203F}-\\x{2040}';
$ncName = '['.$ncNameStartChar.']['.$ncNameChar.']*';
$regexp = sprintf('/(?P<prefix>%s):%s/iu', $ncName, $ncName);
```

Therefore, I decided NOT to throw an exception if found prefix is actually not a prefix. If a prefix used in xpath doesn't exist we'll still get a warning when running it (`DOMXPath::query(): Undefined namespace prefix`).

The current implementation is simple and will work in most situations. For edge cases, it's still possible to register prefixes manually.

What do you think?

Commits
-------

3292163 [DomCrawler] Fixed an issue with namespace prefix matching being to greedy.
2013-09-26 08:29:27 +02:00
Jakub Zalas
3292163fad [DomCrawler] Fixed an issue with namespace prefix matching being to greedy.
The regexp matching prefixes is naive and matches most of strings followed by a colon. It is also incomplete as it does not match all the supported characters (like the unicode ones). It is simple though and sufficient in most situations.
2013-09-25 23:07:33 +01:00
Fabien Potencier
498d8c0ba3 updated VERSION for 2.2.7 2013-09-25 21:27:10 +02:00
Fabien Potencier
3fb8ad2d88 update CONTRIBUTORS for 2.2.7 2013-09-25 21:13:45 +02:00
Fabien Potencier
55de9d9746 merged branch bschussek/form-debugger (PR #9082)
This PR was merged into the master branch.

Discussion
----------

[Form] Implemented form debugger

Same as #9021 (kudos to @digitalkaoz!), with some added caramel.

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

**Note:** Please keep in mind that this is a first version only. Not all features (especially UX/UI-wise) that I'd like to see are in there, but it's good enough for a first merge.

Commits
-------

89509d9 [Form] Improved form debugger
f56c577 [HttpKernel] Extracted value exporting logic of DataCollector into a separate ValueExporter class
56d78ed [Form] Decoupled methods of ResolvedFormType so that they can be overridden individually by decorators
a994a5d [Form] Merged subsriber/collector, also collect valid forms
1972a91 [Form] Added form debug collector
2013-09-25 19:00:08 +02:00
Bernhard Schussek
89509d9847 [Form] Improved form debugger 2013-09-25 17:47:13 +02:00
Bernhard Schussek
f56c5774a8 [HttpKernel] Extracted value exporting logic of DataCollector into a separate ValueExporter class 2013-09-25 17:47:12 +02:00
Fabien Potencier
e43955ac96 updated CHANGELOG for 2.2.7 2013-09-25 16:49:03 +02:00
Bernhard Schussek
56d78eda56 [Form] Decoupled methods of ResolvedFormType so that they can be overridden individually by decorators 2013-09-25 15:59:51 +02:00
Robert Schönthal
a994a5d410 [Form] Merged subsriber/collector, also collect valid forms 2013-09-25 15:59:51 +02:00
Robert Schönthal
1972a91653 [Form] Added form debug collector 2013-09-25 15:59:51 +02:00
Fabien Potencier
36d22ca9f7 merged branch povilas/cookiejar-bugfix (PR #9125)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #9125).

Discussion
----------

[BrowserKit] bugix: CookieJar returns cookies with domain "domain.com" f...

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

Fixes this bug:
```php
$cookieJar = new CookieJar();
$cookieJar->set(new Cookie('foo', 'bar', null, '/', '.example.com'));

print_r($cookieJar->allValues('http://wwwexample.com'));
// expected result: array()
// actual result: array('foo' => 'bar')
```

Commits
-------

060b28e [BrowserKit] bugix: CookieJar returns cookies with domain "domain.com" for domain "foodomain.com"
2013-09-25 15:49:28 +02:00
Povilas Skruibis
89809541b9 bugix: CookieJar returns cookies with domain "domain.com" for domain "foodomain.com" 2013-09-25 15:49:28 +02:00
Fabien Potencier
213480135c merged branch kepten/fix_form_attribute_handling (PR #9124)
This PR was merged into the 2.3 branch.

Discussion
----------

[DomCrawler] fixed HTML5 form attribute handling XPath query

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | 0a67c88e0e (commitcomment-4120595)
| License       | MIT
| Doc PR        | no

The XPath query used was not handling descendant form elements correctly, so I fixed it and added tests for it.

Commits
-------

bb59ac2 fixed HTML5 form attribute handling XPath query
2013-09-25 13:19:32 +02:00
Fabien Potencier
6c18f6015a merged branch jakzal/merge-fix (PR #9122)
This PR was merged into the 2.3 branch.

Discussion
----------

Removed old way of building icu data

Somehow these lines leaked from 2.2 while merging #9018. This needs to go to 2.3 and master.

Commits
-------

714a762 Removed old way of building icu data.
2013-09-25 13:15:31 +02:00
Robert Kiss
bb59ac2879 fixed HTML5 form attribute handling XPath query 2013-09-25 11:22:53 +02:00
Jakub Zalas
714a762fc9 Removed old way of building icu data. 2013-09-25 09:44:05 +01:00
Fabien Potencier
98c0d38a44 merged branch jakzal/domcrawler-namespace-autodiscovery (PR #6650)
This PR was merged into the master branch.

Discussion
----------

[DomCrawler] Added auto-discovery and explicit registration of namespaces in filter() and filterByXPath()

| Q | A
| --- | ---
|Bug fix: | no
|Feature addition: |yes
|Backwards compatibility break: | yes, default namespace is no longer removed in the `addContent` method
|Symfony2 tests pass: | yes|
|Fixes the following tickets: | #4845
|Todo: | -
|License of the code:| MIT
|Documentation PR: | symfony/symfony-docs#2979

* added support for automatic discovery and explicit registration of document namespaces for `Crawler::filterXPath()` and `Crawler::filter()`
* improved content type guessing in `Crawler::addContent()`
* [BC BREAK] `Crawler::addXmlContent()` no longer removes the default document namespace

I mentioned in #4845 it would probably be possible to use [DOMNode::lookupNamespaceURI()](http://www.php.net/manual/en/domnode.lookupnamespaceuri.php) to find a namespace URI by given prefix. Unfortunately we cannot use it here since we'd have to call it on a node in the namespace we're looking for.

Current implementation makes the following query to find a namespace:
```php
$domxpath->query('(//namespace::*[name()="media"])[last()]')
```

Commits
-------

77e2fa5 [DomCrawler] Removed checks if CssSelector is present.
9110468 [DomCrawler] Enabled manual namespace registration.
be1e4e6 [DomCrawler] Enabled default namespace prefix overloading.
943d446 [DomCrawler] Updated the CHANGELOG with namespace auto-registration details.
c6fbb13 [DomCrawler] Added support for an automatic default namespace registration.
587e2dd [DomCrawler] Made that default namespace is no longer removed when loading documents with addXmlContent().
c905bba [DomCrawler] Added more tests for namespaced filtering.
6e717a3 [DomCrawler] Made sure only the default namespace is removed when loading an XML content.
e5b8abb [DomCrawler] Added auto-discovery of namespaces in Crawler::filter() and Crawler::filterByXPath().
2013-09-25 08:05:47 +02:00
Fabien Potencier
6a28718453 Merge branch '2.3'
* 2.3:
  Run all tests in parallel.
  Fixed an entity class name.
  [HttpKernel] fix usage of deprecated FlattenException

Conflicts:
	src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php
2013-09-25 08:04:58 +02:00
Fabien Potencier
453f0d25f7 Merge branch '2.2' into 2.3
* 2.2:
  Run all tests in parallel.
  Fixed an entity class name.

Conflicts:
	.travis.yml
	src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
2013-09-25 08:04:15 +02:00
Fabien Potencier
3ab545734a merged branch adrienbrault/metadata-bag-test (PR #9118)
This PR was merged into the master branch.

Discussion
----------

[HttpFoundation] Remove useless reflection usage in MetadataBagTest

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

Commits
-------

ea27961 [HttpFoundation] Remove useless reflection usage in MetadataBagTest
2013-09-25 08:02:00 +02:00
Fabien Potencier
53b2048c4c merged branch Tobion/flattenexception (PR #9111)
This PR was merged into the 2.3 branch.

Discussion
----------

[HttpKernel] fix usage of deprecated FlattenException

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9108
| License       | MIT

Commits
-------

8bad61d [HttpKernel] fix usage of deprecated FlattenException
2013-09-25 08:01:03 +02:00
Fabien Potencier
9016f7dd68 merged branch jakzal/travis-parallel-tests (PR #9018)
This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #9018).

Discussion
----------

Parallelized travis builds

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

Yet another approach to running all tests in parallel (see #7708 and #8312).

This one uses [GNU Parallel](http://www.gnu.org/software/parallel/) which by default [will run one job per available CPU](http://www.gnu.org/software/parallel/man.html#jobs_n).

Comparison of random builds (recent build times on my travis account):

| PHP version| [master](https://travis-ci.org/jakzal/symfony/builds/11300678)             |  [parallel](https://travis-ci.org/jakzal/symfony/builds/11300689)
| ------------- | --- | ---
| 5.3.3| 6 min 11 sec | 3 min 45 sec
| 5.3| 7 min 26 sec | 4 min 10 sec
| 5.4| 6 min 31 sec | 3 min 31 sec
| 5.5| 6 min 37 sec | 3 min 45 sec

On my laptop it takes 1.5min to run a whole suite parallelised (compared to over 4min when run as usual).

Commits
-------

de8d1b5 Run all tests in parallel.
2013-09-25 07:59:10 +02:00
Jakub Zalas
bcbe8d2d48 Run all tests in parallel. 2013-09-25 07:58:50 +02:00
tweini
90d59ea6cd Update FormTypeCsrfExtension.php
There is no need to store the FormFactory in an Attribute.
The FormFactory can be retrieved directly.
2013-09-25 07:26:45 +02:00
Adrien Brault
ea27961eaa [HttpFoundation] Remove useless reflection usage in MetadataBagTest 2013-09-24 14:45:54 -07:00
Jakub Zalas
77e2fa5c98 [DomCrawler] Removed checks if CssSelector is present. 2013-09-24 21:21:41 +01:00
Fabien Potencier
b3c76ef90e merged branch jakzal/benchmark-tests-fix (PR #9117)
This PR was merged into the 2.2 branch.

Discussion
----------

Fixed an entity class name in a benchmark test

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

Broken in #7940 (67ba131458). Since benchmark tests are not run on travis, it didn't complain.

Commits
-------

50ff35a Fixed an entity class name.
2013-09-24 21:02:37 +02:00
Jakub Zalas
50ff35a49b Fixed an entity class name.
Broken in #7940.
2013-09-24 19:21:01 +01:00
Tobias Schultze
8bad61daf5 [HttpKernel] fix usage of deprecated FlattenException 2013-09-24 12:40:06 +02:00
Fabien Potencier
5ebaad33e6 added a note about why the debug dispatcher cannot be used everywhere 2013-09-23 18:04:04 +02:00
Fabien Potencier
5ed1d01449 Merge branch '2.3'
* 2.3:
  Revert "merged branch fabpot/event-dispatcher-debug (PR #9068)"
2013-09-23 17:56:38 +02:00
Fabien Potencier
c60a8e962b Merge branch '2.2' into 2.3
* 2.2:
  Revert "merged branch fabpot/event-dispatcher-debug (PR #9068)"

Conflicts:
	src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php
	src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterListenersPassTest.php
2013-09-23 17:56:30 +02:00
Fabien Potencier
c2f935593d Revert "merged branch fabpot/event-dispatcher-debug (PR #9068)"
This reverts commit 1843b82015, reversing
changes made to 510960ed31.
2013-09-23 17:54:49 +02:00
Fabien Potencier
c43c35cd17 [ExpressionLanguage] fixed CS 2013-09-23 12:22:40 +02:00
Fabien Potencier
db00c3f510 merged branch adrienbrault/expression-cache (PR #9095)
This PR was squashed before being merged into the master branch (closes #9095).

Discussion
----------

[ExpressionLanguage] Introduce a ParserCacheInterface with array/doctrine implementations

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

Commits
-------

c8e6799 [ExpressionLanguage] Introduce a ParserCacheInterface with array/doctrine implementations
2013-09-23 12:19:21 +02:00
Adrien Brault
c8e679970e [ExpressionLanguage] Introduce a ParserCacheInterface with array/doctrine implementations 2013-09-23 12:19:21 +02:00
Joseph Bielawski
d997443ab0 [HttpFoundation] Header HTTP_X_FORWARDED_PROTO can contain various values
Some proxies use `ssl` instead of `https`, as well as Lighttpd mod_proxy allows
value chaining (`https, http`, where `https` is always first when request is encrypted).
2013-09-23 10:18:01 +02:00
Fabien Potencier
92e940fd14 merged branch fabpot/max-password-length (PR #9100)
This PR was merged into the master branch.

Discussion
----------

[Security] limited the password length passed to encoders

Commits
-------

f7d0ec6 [Security] limited the password length passed to encoders
2013-09-23 09:32:35 +02:00
Fabien Potencier
f7d0ec6f4a [Security] limited the password length passed to encoders 2013-09-23 09:15:09 +02:00
Jakub Zalas
9110468e99 [DomCrawler] Enabled manual namespace registration. 2013-09-22 23:45:02 +01:00
Jakub Zalas
be1e4e6585 [DomCrawler] Enabled default namespace prefix overloading. 2013-09-22 23:05:57 +01:00
Jakub Zalas
943d446e61 [DomCrawler] Updated the CHANGELOG with namespace auto-registration details. 2013-09-22 23:05:57 +01:00
Jakub Zalas
c6fbb13938 [DomCrawler] Added support for an automatic default namespace registration. 2013-09-22 23:05:57 +01:00
Jakub Zalas
587e2dd44f [DomCrawler] Made that default namespace is no longer removed when loading documents with addXmlContent(). 2013-09-22 23:05:56 +01:00
Jakub Zalas
c905bba6a0 [DomCrawler] Added more tests for namespaced filtering. 2013-09-22 23:05:56 +01:00
Jakub Zalas
6e717a3092 [DomCrawler] Made sure only the default namespace is removed when loading an XML content. 2013-09-22 23:05:56 +01:00
Jakub Zalas
e5b8abb564 [DomCrawler] Added auto-discovery of namespaces in Crawler::filter() and Crawler::filterByXPath().
Improved content type guessing.
2013-09-22 23:05:56 +01:00
Fabien Potencier
b1542f0620 Merge branch '2.3'
* 2.3:
  [Locale] added support for the position argument to NumberFormatter::parse()
  [Locale] added some more stubs for the number formatter
  [Yaml] fixed typo
  [Yaml] fixed a test on PHP < 5.4
  [DomCrawler]Crawler guess charset from html
  fixed PHP 5.3 compatibility
  [Yaml] reverted previous merge partially (refs #8897)
  [Security] remove unused logger
  [Security] fix typo
  [Yaml] Fixed filename in the ParseException message
2013-09-22 20:04:51 +02:00
Fabien Potencier
775a39c5c3 Merge branch '2.2' into 2.3
* 2.2:
  [Locale] added support for the position argument to NumberFormatter::parse()
  [Locale] added some more stubs for the number formatter
  [Yaml] fixed typo
  [Yaml] fixed a test on PHP < 5.4
  [DomCrawler]Crawler guess charset from html
  fixed PHP 5.3 compatibility
  [Yaml] reverted previous merge partially (refs #8897)
  [Security] remove unused logger
  [Security] fix typo
  [Yaml] Fixed filename in the ParseException message

Conflicts:
	src/Symfony/Component/Console/Input/InputDefinition.php
	src/Symfony/Component/Locale/Stub/StubNumberFormatter.php
	src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php
2013-09-22 20:04:39 +02:00