Skip to content

Conversation

@rvanlaak
Copy link

@rvanlaak rvanlaak commented Aug 5, 2025

This PR fixes a regression that was introduced by https://github.com/symfony/symfony/pull/61151/files#diff-f159a30ba80133f23e1d36531531f6af7a6ce4ae11aae49480d95e6895d6010cR159-R165 for ObjectMapper that was released on 7.3.2 related to "too eagerly" mapping a constructor's promoted property, without checking whether source actually requires mapping that property. Before 7.3.2 the promoted properties were not checked at all and thus were ignored.

What changed

  • Added test case where target has a required promoted property, which was set already and thus should not be written when not on source.
  • Simplified the responsibility and lowered complexity of getSourceReflectionClass, to solely get the reflection class of the source. Made falling back to the targetRefl instance the responsibility of the callee.

Side note

  • Could also point this PR to symfony/7.3 directly?
  • While debugging, it is quite hard to understand what all local variables in the map method do, especially as in situations where source does not have any mapping metadata set the target's reflection class gets used. Given the component still is marked experimental; what about extracting several key methods and naming them to what they do?

@soyuka soyuka merged commit 0eb00b7 into soyuka:fix-61027 Aug 6, 2025
@rvanlaak rvanlaak deleted the fix-61027_testcase branch August 6, 2025 08:19
nicolas-grekas pushed a commit that referenced this pull request Aug 12, 2025
soyuka pushed a commit that referenced this pull request Aug 19, 2025
…m (soyuka, rvanlaak)

This PR was merged into the 7.3 branch.

Discussion
----------

[ObjectMapper] read source metadata before transform

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | fixes symfony#61027
| License       | MIT

Commits
-------

c1e4adf [ObjectMapper] do not require mapping a target's required promoted property when not on source (#2)
50e177d [ObjectMapper] read source metadata before transform
soyuka pushed a commit that referenced this pull request Aug 19, 2025
* 7.3:
  [ObjectMapper] do not require mapping a target's required promoted property when not on source (#2)
  [GitHub] Update .github/PULL_REQUEST_TEMPLATE.md to remove SF 7.2 as it's not supported anymore
  [WebProfilerBundle] Fix toolbar not rendering after replacing it
  Add friendly name in the `to` field
  [ObjectMapper] read source metadata before transform
  [HtmlSanitizer] Fix force_attributes not replacing existing attribute in initial data
soyuka pushed a commit that referenced this pull request Oct 24, 2025
* 7.4:
  [ObjectMapper] do not require mapping a target's required promoted property when not on source (#2)
  run tests with PHPUnit 12.3
  [GitHub] Update .github/PULL_REQUEST_TEMPLATE.md to remove SF 7.2 as it's not supported anymore
  [CI] fixed the Intl data tests actions Tests fails due to unknown option -v which is shorthand of the --verbose as per the phpunit its removed without any replacement sebastianbergmann/phpunit#5647 (comment)
  [Mailer] Fix expected exception message to include quotes around "http(s)://"
  [WebProfilerBundle] Fix toolbar not rendering after replacing it
  [Validator] (60455) Validate translations for Arabic (ar)
  (60474) Remove translation state attribute for Twig template validator in Ukrainian translation
  [VarDumper] Fix dumping objects from the DOM extension
  [Mailer] Add MicrosoftGraph API Transport
  [Yaml] Fix code style
  [Tests] Adapt testAddHtmlContentWithErrors to be HTML5 compliant
  Add friendly name in the `to` field
  [ObjectMapper] read source metadata before transform
  [HtmlSanitizer] Fix force_attributes not replacing existing attribute in initial data
soyuka pushed a commit that referenced this pull request Nov 13, 2025
…eout must be positive` (Jeroeny)

This PR was merged into the 6.4 branch.

Discussion
----------

[HttpClient] Fix `Warning: curl_multi_select(): timeout must be positive`

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

Full error text: `ErrorException: Warning: curl_multi_select(): timeout must be between 0 and 2147484`

Somehow this timeout is a negative float in some cases. I haven't been able to reproduce it manually. Here's an example:

<img width="979" height="920" alt="image" src="https://github.com/user-attachments/assets/57e44026-cb1a-412c-acb2-b94ec13de48e" />

```
ErrorException: Warning: curl_multi_select(): timeout must be between 0 and 2147484
#0 /vendor/symfony/http-client/Response/CurlResponse.php(342): Symfony\Component\HttpClient\Response\CurlResponse::select
#1 /vendor/symfony/http-client/Response/TransportResponseTrait.php(298): Symfony\Component\HttpClient\Response\CurlResponse::stream
#2 /vendor/symfony/http-client/Response/CommonResponseTrait.php(148): Symfony\Component\HttpClient\Response\CurlResponse::initialize
symfony#3 /vendor/symfony/http-client/Response/TransportResponseTrait.php(130): Symfony\Component\HttpClient\Response\CurlResponse::doDestruct
symfony#4 /vendor/symfony/http-client/Response/CurlResponse.php(242): Symfony\Component\HttpClient\Response\CurlResponse::__destruct
symfony#5 /vendor/sentry/sentry/src/Client.php(177): Sentry\Client::captureEvent
symfony#6 /vendor/sentry/sentry/src/State/Hub.php(155): Sentry\State\Hub::captureEvent
symfony#7 /vendor/sentry/sentry/src/Tracing/Transaction.php(188): Sentry\Tracing\Transaction::finish
symfony#8 /vendor/..redacted(): ...::shutdownHandler
symfony#9 [internal](0)
```

Not sure if this is the place to enforce the `>=0` float or in https://github.com/symfony/symfony/blob/7.4/src/Symfony/Component/HttpClient/Response/CurlResponse.php#L363

Commits
-------

17eec0c Fix Warning: curl_multi_select(): timeout must be positive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants