10000 [Form] Outstanding patches for Choice/Collection fields (cleaned up) by jmikola · Pull Request #17 · fabpot/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Outstanding patches for Choice/Collection fields (cleaned up) #17

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
7 commits merged into from
Sep 10, 2010
Merged

[Form] Outstanding patches for Choice/Collection fields (cleaned up) #17

7 commits merged into from
Sep 10, 2010

Conversation

jmikola
Copy link
@jmikola jmikola commented Sep 9, 2010

These commits were sitting around in a github convo I had months ago with Bernhard.

Please disregard the previous pull request with 10 commits - I cleaned them up here (fresh merge with your symfony/master) and removed two irrelevant commits.

Jeremy Mikola added 7 commits September 9, 2010 16:01
…ted FieldGroups

Property paths such as fields[group].fields[innerGroup].data were not being resolved correctly, since the second iteration of addError() (based on "group") would attempt to call get('fields') instead of get('innerGroup').  Solution is to remember to bump the propertyPath forward if we're at the fields property
@fabpot
Copy link
Owner
fabpot commented Sep 10, 2010

Thanks a lot!

@fabpot
Copy link
Owner
fabpot commented Sep 10, 2010

I thought tests would pass, but that's not the case. I don't revert the changes, but can you have a look at the broken tests and fix them asap? Thanks

@jmikola
Copy link
Author
jmikola commented Sep 10, 2010

Yes, will look at this today.

By any chance, was it just this one test? http://github.com/jmikola/symfony/commit/9f5469f62d2096bc486ecd31202dc2931bfd040f

I copied over the comment from my older commit, explaining that this fails. If others are, I'll get to those first (since they certainly shouldn't :), but I'll move to 95f468 last.

@fabpot
Copy link
Owner
fabpot commented Sep 10, 2010

Here is the test output I have:

There were 6 errors:

1) Symfony\Tests\Component\Form\CollectionFieldTest::testSetDataAdjustsSize
InvalidArgumentException: Field "0" does not exist.

.../src/Symfony/Component/Form/FieldGroup.php:209
.../src/Symfony/Component/Form/FieldGroup.php:508
.../tests/Symfony/Tests/Component/Form/CollectionFieldTest.php:25

2) Symfony\Tests\Component\Form\CollectionFieldTest::testSetDataAdjustsSizeIfModifiable
InvalidArgumentException: Field "0" does not exist.

.../src/Symfony/Component/Form/FieldGroup.php:209
.../src/Symfony/Component/Form/FieldGroup.php:508
.../tests/Symfony/Tests/Component/Form/CollectionFieldTest.php:45

3) Symfony\Tests\Component\Form\CollectionFieldTest::testModifiableCollectionsContainExtraField
InvalidArgumentException: Field "0" does not exist.

.../src/Symfony/Component/Form/FieldGroup.php:209
.../src/Symfony/Component/Form/FieldGroup.php:508
.../tests/Symfony/Tests/Component/Form/CollectionFieldTest.php:71

4) Symfony\Tests\Component\Form\CollectionFieldTest::testCollectionOfFieldGroupsBoundWithArrayObjectContainingObjects
Symfony\Component\Form\Exception\UnexpectedTypeException: You must pass an array parameter to the bind() method

.../src/Symfony/Component/Form/FieldGroup.php:301
.../src/Symfony/Component/Form/CollectionField.php:85
.../tests/Symfony/Tests/Component/Form/CollectionFieldTest.php:140

5) Symfony\Bundle\FrameworkBundle\Tests\Controller\ControllerNameConverterTest::testToShortNotation
InvalidArgumentException: The parameter "csrf_secret" must be defined.

.../src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:77
.../src/Symfony/Component/DependencyInjection/Container.php:118
.../src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php:29
.../src/Symfony/Framework/Kernel.php:138
.../src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameConverterTest.php:27

6) Symfony\Bundle\FrameworkBundle\Tests\Controller\ControllerNameConverterTest::testFromShortNotation
InvalidArgumentException: The parameter "csrf_secret" must be defined.

.../src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:77
.../src/Symfony/Component/DependencyInjection/Container.php:118
.../src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php:29
.../src/Symfony/Framework/Kernel.php:138
.../src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameConverterTest.php:64

--


There were 3 failures:

1) Symfony\Tests\Component\Form\ChoiceFieldTest::testConfigureChoicesWithArrayObject
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array
 (
-    [a] => Bernhard
-    [b] => Fabien
-    [c] => Kris
-    [d] => Jon
-    [e] => Roman
+    [a] => 
+    [b] => 
+    [c] => 
+    [d] => 
+    [e] => 
 )

.../tests/Symfony/Tests/Component/Form/ChoiceFieldTest.php:50

2) Symfony\Tests\Component\Form\CollectionFieldTest::testNotResizedIfBoundWithMissingData
Failed asserting that <boolean:false> is true.

.../tests/Symfony/Tests/Component/Form/CollectionFieldTest.php:82

3) Symfony\Tests\Component\Form\CollectionFieldTest::testNotResizedIfBoundWithExtraData
Failed asserting that <boolean:false> is true.

.../tests/Symfony/Tests/Component/Form/CollectionFieldTest.php:107

FAILURES!
Tests: 1445, Assertions: 3984, Failures: 3, Errors: 6, Skipped: 101.

fabpot added a commit that referenced this pull request Jul 21, 2022
…es (SerafimArts)

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

Discussion
----------

[VarDumper] Add `FFI\CData` and `FFI\CType` types

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Added support of FFI:
```php
$ffi = \FFI::cdef(<<<'CPP'
    typedef struct { int x; int y; } Point;
    typedef struct Example {
        uint8_t array[32];
        long longVal;
        __extension__ union {
            __extension__ struct { short shortVal; };
            struct { Point point; float e; };
        };
        bool boolValue;
        int (*func)(struct __sub *h);
    } Example;
CPP);

$struct = $ffi->new('Example');
$struct->func = (static fn (object $ptr) => 42);

dump($struct);
```

**Before**

```
FFI\CData {#2}
```

**After**

```
FFI\CData<struct Example> size 64 align 8 {#2
  +array: FFI\CData<uint8_t[32]> size 32 align 1 {#18}
  +int32_t longVal: 0
  +int16_t shortVal: 0
  +point: FFI\CData<struct <anonymous>> size 8 align 4 {#17
    +int32_t x: 0
    +int32_t y: 0
  }
  +float e: 0.0
  +bool boolValue: false
  +func: [cdecl] callable(struct __sub*): int32_t {#20
    returnType: FFI\CType<int32_t> size 4 align 4 {#25}
  }
}
```

P.S. I apologize for the multiple force pushes, errors in tests and codestyle have been fixed.

## Review And TODOs

- Pointers
  - [x] Pointer to scalar tests.
  - [x] Pointer to struct tests.
  - [x] "Special" pointer to `char*` tests (with `\0` and without `\0`).
- Possible Errors
  - [x] Do not dump union fields with pointer references (possible SIGSEGV).

Commits
-------

1c7dc52 [VarDumper] Add `FFI\CData` and `FFI\CType` types
fabpot pushed a commit that referenced this pull request Mar 21, 2024
…hen publishing a message. (jwage)

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

Discussion
----------

[Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix symfony#36538 Fix symfony#48241
| License       | MIT

If you have a message handler that dispatches messages to another queue, you can encounter `AMQPConnectionException` with the message "Library error: a SSL error occurred" or "a socket error occurred"  depending on if you are using tls or not or if you are running behind a load balancer or not.

You can manually reproduce this issue by dispatching a message where the handler then dispatches another message to a different queue, then go to rabbitmq admin and close the connection manually, then dispatch another message and when the message handler goes to dispatch the other message, you will get this exception:

```
a socket error occurred
#0 /vagrant/vendor/symfony/amqp-messenger/Transport/AmqpTransport.php(60): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpSender->send()
#1 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(62): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport->send()
#2 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle()
#3 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(61): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle()
#4 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle()
#5 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
#6 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
#7 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
#8 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
#9 /vagrant/src/Messenger/MessageBus.php(37): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
#10 /vagrant/vendor/symfony/mailer/Mailer.php(66): App\Messenger\MessageBus->dispatch()
#11 /vagrant/src/Mailer/Mailer.php(83): Symfony\Component\Mailer\Mailer->send()
#12 /vagrant/src/Mailer/Mailer.php(96): App\Mailer\Mailer->send()
#13 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(118): App\Mailer\Mailer->sendEmail()
#14 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(72): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->handle()
#15 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(152): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->__invoke()
#16 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(91): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->callHandler()
#17 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(71): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->handle()
#18 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle()
#19 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(68): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle()
#20 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle()
#21 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
#22 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
#23 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
#24 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
#25 /vagrant/vendor/symfony/messenger/RoutableMessageBus.php(54): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
#26 /vagrant/vendor/symfony/messenger/Worker.php(162): Symfony\Component\Messenger\RoutableMessageBus->dispatch()
#27 /vagrant/vendor/symfony/messenger/Worker.php(109): Symfony\Component\Messenger\Worker->handleMessage()
#28 /vagrant/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php(238): Symfony\Component\Messenger\Worker->run()
#29 /vagrant/vendor/symfony/console/Command/Command.php(326): Symfony\Component\Messenger\Command\ConsumeMessagesCommand->execute()
#30 /vagrant/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#31 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand()
#32 /vagrant/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()
#33 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun()
#34 /vagrant/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
#35 /vagrant/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run()
#36 /vagrant/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
#37 /vagrant/bin/console(11): require_once('...')
#38 {main}
```

TODO:

- [x] Add test for retry logic when publishing messages

Commits
-------

f123370 [Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.
This pull request was closed.
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
0