forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
[HttpKernel] Add Kernel::terminate() and HttpKernel::terminate() for post-response logic (without the BC break) #1
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Should be called after sending the response and before shutting down the kernel. | ||
* | ||
* @api | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be {@inheritdoc}
instead of copying it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 9f4391f
Seldaek
added a commit
that referenced
this pull request
Dec 6, 2011
[HttpKernel] Add Kernel::terminate() and HttpKernel::terminate() for post-response logic (without the BC break)
Seldaek
pushed a commit
that referenced
this pull request
Jan 8, 2012
Commits ------- 7c2f11f Merge pull request #1 from pminnieur/post_response 9f4391f [HttpKernel] fixed DocBlocks 2a61714 [HttpKernel] added PostResponseEvent dispatching to HttpKernel 915f440 [HttpKernel] removed BC breaks, introduced new TerminableInterface 7efe4bc [HttpKernel] Add Kernel::terminate() and HttpKernel::terminate() for post-response logic Discussion ---------- [HttpKernel] Add Kernel::terminate() and HttpKernel::terminate() for post-response logic This came out of a discussion on IRC about doing stuff post-response, and the fact that right now there is no best practice, and it basically requires adding code after the `->send()` call. It's an attempt at fixing it in an official way. Of course terminate() would need to be called explicitly, and added to the front controllers, but then it offers a standard way for everyone to listen on that event and do things without slowing down the user response. --------------------------------------------------------------------------- by stof at 2011/12/06 02:41:26 -0800 We discussed it on IRC and I suggested a way to avoid the BC break of the interface: adding a new interface (``TerminableInterface`` or whatever better name you find) containing this method. HttpKernel, Kernel and HttpCache can then implement it without breaking the existing apps using the component (Kernel and HttpCache would need an instanceof check to see if the inner kernel implements the method) For Symfony2 users it will mean they have to change their front controller to benefit from the new event of course, but this is easy to do. Btw, Silex can then be able to use it without *any* change for the end users as it can be done inside ``Application::run()`` --------------------------------------------------------------------------- by pminnieur at 2011/12/06 11:47:03 -0800 @Seldaek: I opened a pull request so that the discussion on IRC is fulfilled and no BC breaks exist: https://github.com/Seldaek/symfony/pull/1/files --------------------------------------------------------------------------- by fabpot at 2011/12/07 07:59:49 -0800 Any real-world use case for this? --------------------------------------------------------------------------- by Seldaek at 2011/12/07 08:10:31 -0800 Doing slow stuff after the user got his response back without having to implement a message queue. I believe @pminnieur wanted to use it to send logs to loggly? --------------------------------------------------------------------------- by pminnieur at 2011/12/07 09:08:41 -0800 Its a good practice to defer code execution without the introduction of a new software layer (like gearman, amqp, whatever tools people use to defer code execution) which may be way too much just for the goal of having fast responses, whatever my code does. My real world use case which made me miss this feature the first time: > I have a calendar with a scheduled Event. For a given period of time, several Event entities will be created, coupled to the scheduled event (the schedule Event just keeps track of `startDate`, `endDate` and the `dateInterval`). Let's say we want this scheduled Event to be on every Monday-Friday, on a weekly basis, for the next 10 years. This means I have to create `10*52*5` Event entities before I could even think about sending a simple redirect response. If I could defer code execution, I'd only save the scheduled Event, send the redirect response and after that, I create the `10*52*5` entities. The other use case was loggly, yes. Sending logging data over the wire before the response is send doesn't make sense in my eyes, so it could be deferred after the response is send (this especially sucks if loggly fails and i get a 500 --the frontend/public user is not interested in a working logging facility, he wants his responses). --------------------------------------------------------------------------- by mvrhov at 2011/12/07 10:07:03 -0800 This would help significantly, but the real problem, that your process is busy and unavailable for the next request, is still there. --------------------------------------------------------------------------- by fabpot at 2011/12/07 10:15:18 -0800 I think this is the wrong solution for a real problem. Saying "Its a good practice to defer code execution without the introduction of a new software layer" is just wrong. It is definitely a good practice to defer code execution, but you should use the right tool for the job. I'm -1. --------------------------------------------------------------------------- by pminnieur at 2011/12/07 10:25:44 -0800 It should just give a possibility to put unimportant but heavy lifting code behind the send request with ease. With little effort people could benefit from the usage of `fastcgi_finish_request` without introducing new software, using `register_shutdown_function` or using `__destruct `(which works for simple things, but may act weird with dependencies). It should not simulate node.js ;-) I agree that the real problem is not solved, but small problems could be solved easily. I personally don't want to setup RabbitMQ or whatever, maintain my crontab or any other software that may allow me to defer code execution. --------------------------------------------------------------------------- by Seldaek at 2011/12/08 01:08:32 -0800 @fabpot: one could say that on shared hostings it is still useful because they generally don't give you gearman or \*MQs. Anyway I think it'd be nice to really complete the HttpKernel event cycle. --------------------------------------------------------------------------- by pminnieur at 2011/12/08 01:48:57 -0800 not only on shared hostings, sometimes teams/projects just don't have the resources or knowledge or time to setup such an infrastructure. --------------------------------------------------------------------------- by videlalvaro at 2011/12/08 01:53:06 -0800 I can say we used `fastcgi_finish_request` quite a lot at poppen with symfony 1.x. It certainly helped us to send data to Graphite, save XHProf runs, send data to RabbitMQ, and so on. For example we used to connect to RabbitMQ and send the messages _after_ calling `fastcgi_finish_request` so the user never had to wait for stuff like that. Also keep in mind that if you are using Gearman or RabbitMQ or whatever tool you use to defer code execution… you are not deferring the network connection handling, sending data over the wire and what not. I know this is obvious but is often overlooked. So it would be nice to have an standard way of doing this. --------------------------------------------------------------------------- by henrikbjorn at 2011/12/13 01:42:23 -0800 This could have been useful recently while implementing a "Poor mans cronjob" system. The solution was to do a custom Response object and do the stuff after send have been called with a Connection: Close header and ignore_user_abort(); (Yes very ugly)
Seldaek
pushed a commit
that referenced
this pull request
Jan 28, 2012
Commits ------- 753c067 [FrameworkBundle] added $view['form']->csrfToken() helper e1aced8 [Twig] added {{ csrf_token() }} helper Discussion ---------- [Twig] [FrameworkBundle] added CSRF token helper I've added a templating helper and Twig function for generating a CSRF token without the overhead of creating a form. ```html+jinja <form action="{{ path('user_delete', { 'id': user.id }) }}" method="post"> <input type="hidden" name="_method" value="delete"> <input type="hidden" name="_token" value="{{ csrf_token('delete_user_' ~ user.id) }}"> <button type="submit">delete</button> </form> ``` ```php <?php class UserController extends Controller { public function delete(User $user, Request $request) { $csrfProvider = $this->get('form.csrf_provider'); if (!$csrfProvider->isCsrfTokenValid('delete_user_'.$user->getId(), $request->request->get('_token')) { throw new RuntimeException('CSRF attack detected.'); } // etc... } } ``` The test that is failing on Travis appears to be unrelated, but I may be wrong? ``` 1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #1 ('de') RuntimeException: OUTPUT: Catchable fatal error: Argument 3 passed to Symfony\Bundle\FrameworkBundle\Controller\TraceableControllerResolver::__construct() must be an instance of Symfony\Component\HttpKernel\Debug\Stopwatch, instance of Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser given, called in /tmp/2.1.0-DEV/StandardFormLogin/cache/securitybundletest/appSecuritybundletestDebugProjectContainer.php on line 94 and defined in /home/vagrant/builds/kriswallsmith/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/TraceableControllerResolver.php on line 37 ``` --------------------------------------------------------------------------- by pablodip at 2012-01-10T14:18:45Z As you don't need forms to use the csrf provider, how about putting its service without the form prefix? It could even make sense to put the CsrfProvider as a component since you can use it standalone and in more cases than only forms. It would be a small component though. --------------------------------------------------------------------------- by Tobion at 2012-01-10T17:54:14Z I think it would be more clear to generate the token in the controller. Doing so in the template will spread the CSRF intention across template and controller. So I don't think this extension is necessary. --------------------------------------------------------------------------- by kriswallsmith at 2012-01-10T17:58:14Z @pablodip I'm open to the idea of a Csrf component. This would be a good place for some nonce classes as well. @Tobion I disagree. One use case is for a list of users, each with a delete form. Iterating over the users in the controller and generating a token for each, just to iterate over them again in the view is a waste and adds complexity. --------------------------------------------------------------------------- by Tobion at 2012-01-10T18:05:14Z I see. But I don't understand why the intention needs to be different for each user to delete. Usually the intention is the same for each form type. I thought this is enough. --------------------------------------------------------------------------- by kriswallsmith at 2012-01-10T18:06:13Z Yes, a static intention would suffice. --------------------------------------------------------------------------- by Tobion at 2012-01-10T18:07:08Z Then your use case is not valid anymore. --------------------------------------------------------------------------- by Tobion at 2012-01-10T18:12:25Z I would suggest to make a cookbook article out of it about how to create a simple form without the form component. And include such things as validating the result using the validator component and checking the CSRF. --------------------------------------------------------------------------- by kriswallsmith at 2012-01-10T21:32:50Z This helper makes it easier to use CSRF protection without a form and we should make it as easy as possible. Spreading the intention across controller and template is not concerning to me. Either way, a cookbook entry is a great idea. --------------------------------------------------------------------------- by Tobion at 2012-01-10T21:47:12Z Well, it's just one line more without this helper. So I disagree it makes it really easier when you know how to use the CsrfProvider which is a pre-condition anyway since you must still validate its correctness by hand. --------------------------------------------------------------------------- by kriswallsmith at 2012-01-13T13:24:15Z Another use case is when rendering a page with a bunch of simple buttons with different intentions: delete user, delete comment, follow, unfollow... Creating all of these in the controller just leads to spaghetti. --------------------------------------------------------------------------- by jwage at 2012-01-17T21:55:53Z :+1: lots of use cases for something like this @opensky
Seldaek
pushed a commit
that referenced
this pull request
Apr 8, 2012
Commits ------- 100e97e [Filesystem] Fixed warnings in makePathRelative(). f5f5c21 [Filesystem] Fixed typos in the docblocks. d4243a2 [Filesystem] Fixed a bug in remove being unable to remove symlinks to unexisting file or directory. 11a676d [Filesystem] Added unit tests for mirror method. 8c94069 [Filesystem] Added unit tests for isAbsolutePath method. 2ee4b88 [Filesystem] Added unit tests for makePathRelative method. 21860cb [Filesystem] Added unit tests for symlink method. a041feb [Filesystem] Added unit tests for rename method. 8071859 [Filesystem] Added unit tests for chmod method. bba0080 [Filesystem] Added unit tests for remove method. 8e861b7 [Filesystem] Introduced workspace directory to limit complexity of tests. a91e200 [Filesystem] Added unit tests for touch method. 7e297db [Filesystem] Added unit tests for mkdir method. 6ac5486 [Filesystem] Added unit tests for copy method. 1c833e7 [Filesystem] Added missing docblock comment. Discussion ---------- [Filesystem] Fixed a bug in remove() being unable to unlink broken symlinks While working on test coverage for Filesystem class I discovered a bug in remove() method. Before removing a file a check is made if it exists: if (!file_exists($file)) { continue; } Problem is [file_exists()](http://php.net/file_exists) returns false if link's target file doesn't exist. Therefore remove() will fail to delete a directory containing a broken link. Solution is to handle links a bit different: if (!file_exists($file) && !is_link($file)) { continue; } Additionally, this PR improves test coverage of Filesystem component. Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes --------------------------------------------------------------------------- by cordoval at 2012-04-07T00:55:59Z ✌.|•͡˘‿•͡˘|.✌ --------------------------------------------------------------------------- by fabpot at 2012-04-07T06:12:34Z Tests do not pass for me: PHPUnit 3.6.10 by Sebastian Bergmann. Configuration read from /Users/fabien/work/symfony/git/symfony/phpunit.xml.dist .........................EE....... Time: 0 seconds, Memory: 5.25Mb There were 2 errors: 1) Symfony\Component\Filesystem\Tests\FilesystemTest::testMakePathRelative with data set #0 ('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../') Uninitialized string offset: 29 .../rc/Symfony/Component/Filesystem/Filesystem.php:183 .../rc/Symfony/Component/Filesystem/Tests/FilesystemTest.php:434 2) Symfony\Component\Filesystem\Tests\FilesystemTest::testMakePathRelative with data set #1 ('var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../') Uninitialized string offset: 16 .../rc/Symfony/Component/Filesystem/Filesystem.php:183 .../rc/Symfony/Component/Filesystem/Tests/FilesystemTest.php:434 FAILURES! Tests: 34, Assertions: 67, Errors: 2. --------------------------------------------------------------------------- by jakzal at 2012-04-07T07:26:15Z Sorry for this. For some reason my PHP error reporting level was to low to catch this... Should be fixed now but I needed to modify the makePathRelative() (this bug existed before).
Seldaek
pushed a commit
that referenced
this pull request
Jul 3, 2012
[FileSystem] explain possible failure of symlink creation in windows
Seldaek
pushed a commit
that referenced
this pull request
Jul 3, 2012
Commits ------- a20fc68 Merge pull request #1 from SamsonIT/FilesystemExceptions 8eca661 [FileSystem] explains possible failure of symlink creation in windows b1f8744 Add Changelog BC Break note 24eb396 [Filesystem] Added few new behaviors: Discussion ---------- [Filesystem] Consistence and enhancements for Filesystem Bug fix: no Feature addition: yes Backwards compatibility break: **yes** Symfony2 tests pass: yes Fixes the following tickets: None License of the code: MIT This PR adds features and introduce a backward compatibility break. features : - whenever an action fails, a \RuntimeException is thrown - add access to the second and third arguments of ``touch`` function - add a recursive option for chmod - add a chown method - add a chgrp method The backward compatibility break happens in the mkdir method : Before this PR, a boolean is returned ; true if all directories were created, false otherwise. It now returns nothing. --------------------------------------------------------------------------- by travisbot at 2012-05-18T14:26:42Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1367000) (merged 83cdd622 into 1e15f21). --------------------------------------------------------------------------- by fabpot at 2012-05-20T02:40:28Z To be consistent, we should throw exception whenever some operation fails. --------------------------------------------------------------------------- by romainneutron at 2012-05-20T21:10:23Z I fix the consistency ; mkdir now throws an exception if a directory creation fails. This introduce a BC break, see PR message which has been updated with all features and BC break. Added chgrp and chown methods Add options for touch Add recursive option for chmod --------------------------------------------------------------------------- by travisbot at 2012-05-20T21:11:47Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1383619) (merged a4d1eeb8 into 1407f11). --------------------------------------------------------------------------- by travisbot at 2012-05-22T10:49:06Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399027) (merged 7e14b6bd into 517ae43). --------------------------------------------------------------------------- by travisbot at 2012-05-22T10:58:10Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399083) (merged 71852653 into 517ae43). --------------------------------------------------------------------------- by travisbot at 2012-05-22T11:18:44Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1399194) (merged 7645bad3 into 517ae43). --------------------------------------------------------------------------- by travisbot at 2012-05-23T18:21:47Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1414091) (merged b049d5b1 into 517ae43). --------------------------------------------------------------------------- by travisbot at 2012-05-23T18:26:19Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1414123) (merged 34903466 into 517ae43). --------------------------------------------------------------------------- by travisbot at 2012-05-29T16:07:26Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1467173) (merged b1d1eb2e into adf07f1). --------------------------------------------------------------------------- by travisbot at 2012-05-29T16:19:38Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1467261) (merged 42015ffa into adf07f1). --------------------------------------------------------------------------- by romainneutron at 2012-06-01T14:30:45Z Any news about this PR ? --------------------------------------------------------------------------- by stloyd at 2012-06-08T09:57:39Z @romainneutron You need to [squash](http://www.silverwareconsulting.com/index.cfm/2010/6/6/Using-Git-Rebase-to-Squash-Commits) your commits, and add more proper message in squashed commit i.e.: > [Filesystem] Added few new behaviors: * whenever an action fails, a `RuntimeException` is thrown * add access to the second and third arguments of `touch()` function * add a recursive option for `chmod()` * add a `chown()` method * add a `chgrp()` method > BC break: `mkdir()` function throw exception in case of failture instead of returning Boolean value. --------------------------------------------------------------------------- by romainneutron at 2012-06-08T10:59:55Z @stloyd squash done ! --------------------------------------------------------------------------- by travisbot at 2012-06-08T11:26:20Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1565540) (merged 8f55ddb6 into f8e68e5). --------------------------------------------------------------------------- by travisbot at 2012-06-08T11:41:45Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1566247) (merged 880312b6 into f8e68e5). --------------------------------------------------------------------------- by romainneutron at 2012-06-09T11:42:24Z I've added documentation to the Filesystem component : symfony/symfony-docs#1439 --------------------------------------------------------------------------- by travisbot at 2012-06-09T16:47:20Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1577754) (merged 5647ad41 into f8a09db). --------------------------------------------------------------------------- by stloyd at 2012-06-13T14:47:31Z @romainneutron You probably need to rebase your code as some changes were merge into master for `Filesystem`. --------------------------------------------------------------------------- by romainneutron at 2012-06-13T15:17:31Z @stloyd rebase OK ! by the way, do you have any idea when/if this PR will be merged ? --------------------------------------------------------------------------- by travisbot at 2012-06-13T15:20:44Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1611591) (merged c8b86c68 into c07e916). --------------------------------------------------------------------------- by fabpot at 2012-06-16T16:40:50Z You need to add a note about the BC breaks in the CHANGELOG file. --------------------------------------------------------------------------- by fabpot at 2012-06-16T16:43:20Z Also, instead of using `\RuntimeException`, I would create a custom exception like we have done in other components (an interface + a RuntimeException that implements the interface and extends \RuntimeException). The exception name can be something like `IOException`. --------------------------------------------------------------------------- by travisbot at 2012-06-18T10:11:20Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1645757) (merged 925a8234 into 0b8b76b). --------------------------------------------------------------------------- by stloyd at 2012-06-18T10:14:52Z @fabpot Anything blocking merge of this PR ? (tests are failing because of issue in master, not releted to this PR) --------------------------------------------------------------------------- by romainneutron at 2012-06-18T10:29:20Z @fabpot @stloyd the latest push was just a rebase push for PR 4577 (symfony#4577) I'm currently fixing the Exception and changelog things, I'll push very soon --------------------------------------------------------------------------- by romainneutron at 2012-06-18T10:44:38Z @fabpot I've added the exception and the exception interface, add the changelog info --------------------------------------------------------------------------- by travisbot at 2012-06-18T10:53:34Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1645981) (merged 634d6fb9 into 0b8b76b). --------------------------------------------------------------------------- by romainneutron at 2012-06-18T11:08:43Z As reported by @stloyd the PR is failing due to an issue in the master, I re-push and trig the PR build when this issue is solved --------------------------------------------------------------------------- by travisbot at 2012-06-18T11:16:58Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1646006) (merged 2f65945a into 0b8b76b).
Seldaek
pushed a commit
that referenced
this pull request
Nov 19, 2012
This PR was merged into the master branch. Commits ------- b550677 [Finder] Fix the BSD adapter 2401274 [Finder] Added bsd adapter (need tests). Discussion ---------- [Finder] Adds bsd adapter. OK on mac os x. --------------------------------------------------------------------------- by fabpot at 2012-10-31T08:22:05Z Here are the results for the Finder tests on my Mac: ``` ............................................................... 63 / 181 ( 34%) ......................find: -regextype: unknown primary or operator F..............find: -regextype: unknown primary or operator find: -regextype: unknown primary or operator .find: -regextype: unknown primary or operator find: -regextype: unknown primary or operator ......................... 126 / 181 ( 69%) ....................................................... Time: 1 second, Memory: 10.75Mb There was 1 failure: 1) Symfony\Component\Finder\Tests\FinderTest::testIgnoreDotFiles with data set #1 (Symfony\Component\Finder\Adapter\PhpAdapter) Failed asserting that two arrays are equal. --- Expected +++ Actual @@ @@ Array ( - 0 => '/var/folders/h7/55h7wcsx4g1cl...r/.bar' - 1 => '/var/folders/h7/55h7wcsx4g1cl...r/.foo' - 2 => '/var/folders/h7/55h7wcsx4g1cl...o/.bar' - 3 => '/var/folders/h7/55h7wcsx4g1cl...r/.git' - 4 => '/var/folders/h7/55h7wcsx4g1cl...er/foo' - 5 => '/var/folders/h7/55h7wcsx4g1cl...oo bar' - 6 => '/var/folders/h7/55h7wcsx4g1cl...ar.tmp' - 7 => '/var/folders/h7/55h7wcsx4g1cl...st.php' - 8 => '/var/folders/h7/55h7wcsx4g1cl...est.py' - 9 => '/var/folders/h7/55h7wcsx4g1cl...r/toto' ) .../src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php:25 .../src/Symfony/Component/Finder/Tests/FinderTest.php:207 phpunit:46 ``` --------------------------------------------------------------------------- by jfsimon at 2012-10-31T08:46:22Z @fabpot thank you! It seems I need to experiment a little more... --------------------------------------------------------------------------- by jfsimon at 2012-11-01T14:38:31Z @fabpot BSD adapter is OK on mac os x.
Seldaek
pushed a commit
that referenced
this pull request
Jan 8, 2013
[FrameworkBundle] Added tests for trusted_proxies configuration.
Seldaek
pushed a commit
that referenced
this pull request
Jan 8, 2013
This PR was merged into the 2.0 branch. Commits ------- f0743b1 Merge pull request #1 from pylebecq/2.0 555e777 [FrameworkBundle] Added tests for trusted_proxies configuration. a0e2391 [FrameworkBundle] used the new method for trusted proxies Discussion ---------- [FrameworkBundle] used the new method for trusted proxies This makes the framework bundle using the new method from the request class. --------------------------------------------------------------------------- by fabpot at 2012-12-05T10:38:20Z As this is a sensitive issue, can you add some tests? Thanks. --------------------------------------------------------------------------- by bamarni at 2012-12-06T13:00:24Z Well I don't know why it fails on travis, I can't run the full test suite locally because of a segfault but ```phpunit src/Symfony/Bundle/``` marks all the tests as passing. --------------------------------------------------------------------------- by fabpot at 2012-12-06T13:08:11Z But it looks like the failing tests come from what you've changed. --------------------------------------------------------------------------- by bamarni at 2012-12-06T13:29:33Z Yes, I'm not saying it's not my fault but I can't reproduce this as locally it tells me they pass, I'll try to fix this this evening. --------------------------------------------------------------------------- by bamarni at 2012-12-06T17:49:28Z Apparently it fails only when running the whole testsuite, looking at other travis builds I can see this one on 2.0 : https://travis-ci.org/symfony/symfony/jobs/3495511 which fails in a similar way than here (https://travis-ci.org/symfony/symfony/jobs/3530928). Because of a place trying to access an undefined $_SERVER key : ```PHP Notice: Undefined index: SCRIPT_NAME ...``` but I can't find where, and the stack trace references some phpunit classes. I'd be happy if someone could give me some pointers in here as I don't have any clue about how to fix this.. --------------------------------------------------------------------------- by bamarni at 2012-12-06T18:00:57Z As a consulsion I'd say I can't run the whole testsuite locally (it fails even when I revert my commit), so there is no reliable way for me to fix this, if anyone is up for continuing this feel free. --------------------------------------------------------------------------- by fabpot at 2012-12-11T09:47:48Z @bamarni Can you just update this PR with the code change and no tests at all? I will then finish the PR. Thanks. --------------------------------------------------------------------------- by bamarni at 2012-12-11T16:58:17Z @fabpot: thanks for helping me out on this, hope you won't run into the same issue!
Seldaek
pushed a commit
that referenced
this pull request
Jan 8, 2013
This PR was merged into the 2.1 branch. Commits ------- 81967f6 [Form] Fixed failing tests for DateTimeToStringTransformer. Discussion ---------- [Form] Fixed failing tests for DateTimeToStringTransformer Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: - Todo: - License of the code: MIT Documentation PR: - Tests were only failing at the end of the month. Since February was used in the test cases, date was being moved to the next month (February has less days than other months). If a day is not passed, \DateTime's constructor will set it to the first day of the month: ```php var_dump(new \DateTime('2010-02')); object(DateTime)#1 (3) { ["date"]=> string(19) "2010-02-01 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London" } ``` \DateTime is used in the test assertions. However, DateTimeToStringTransformer::reverseTransform() uses \DateTime::createFromFormat(), which sets a missing day to the current day: ```php var_dump(\DateTime::createFromFormat("Y-m", '2010-02')); object(DateTime)#1 (3) { ["date"]=> string(19) "2010-03-01 20:09:26" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London" } ``` I changed the date in the test case to avoid failures. If we need to be sure that month's not going to be changed, I'll update my PR.
Seldaek
pushed a commit
that referenced
this pull request
Jan 11, 2013
This PR was merged into the master branch. Commits ------- 0d6be2e Added Portuguese (Portugal) translation to Security 87df0b7 Merge pull request #1 from symfony/master Discussion ---------- Add Portuguese from Portugal Security translation Translation file for portuguese from Portugal added in Security component translations
Seldaek
pushed a commit
that referenced
this pull request
Apr 7, 2013
This PR was merged into the 2.1 branch. Commits ------- 27cc0df Merge pull request #1 from merk/class-loader/idempotent 95af84c Fixed test to use Reflection bb08247 [ClassLoader] tweaked test 73bead7 [ClassLoader] made DebugClassLoader idempotent Discussion ---------- [ClassLoader] made DebugClassLoader idempotent The DebugClassLoader will wrap itself if `enable()` is called multiple time, such as when running functional tests. Please merge to 2.2 and master ASAP. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ --------------------------------------------------------------------------- by kriswallsmith at 2013-03-07T16:38:55Z ping @fabpot: this will speed up lots of functional tests :) --------------------------------------------------------------------------- by kriswallsmith at 2013-03-08T04:51:51Z @fabpot fixed by @merk
Seldaek
pushed a commit
that referenced
this pull request
Jun 7, 2014
This PR was submitted for the 2.4 branch but it was merged into the 2.5-dev branch instead (closes symfony#9857). Discussion ---------- Form Debugger JavaScript improvements | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | - | Deprecations? | - | Tests pass? | - | Fixed tickets | symfony#9123 | License | MIT | Doc PR | - Commits ------- 406756d Reverted Sfjs.toggle change 226ac7c Reverted new image 53f164f Fixed asset function c763d65 Merge pull request #1 from bschussek/issue9857 5afbaeb [WebProfilerBundle] Enlarged the clickable area of the toggle button in the form tree 58559d3 [WebProfilerBundle] Moved toggle icon behind the headlines in the form debugger a0030b8 [WebProfilerBundle] Changed toggle color back to blue and made headlines in the form debugger clickable 505c5be [WebProfilerBundle] Added "use strict" statements ebf13ed [WebProfilerBundle] Inverted toggler images and improved button coloring 07994d5 [WebProfilerBundle] Improved JavaScript of the form debugger 11bfda6 [WebProfilerBundle] Vertically centered the icons in the form tree 52b1620 Fixed CS f21dab2 Added error badge 111a404 Made sections collapsable 60b0764 Improved form tree 0e03189 Expand tree
Seldaek
pushed a commit
that referenced
this pull request
Nov 12, 2014
…webmozart) This PR was merged into the 2.3 branch. Discussion ---------- [Intl] Integrated ICU data into Intl component #1 | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#11447, symfony#10807 | License | MIT | Doc PR | - This PR is an alternative implementation to symfony#11884. It depends on ~~symfony#11906~~ and ~~symfony#11907~~ being merged first (~~these are included in the diff until after a merge+rebase~~ merged+rebased now). With this PR, the ICU component becomes obsolete. The ICU data is bundled with Intl in two different formats: JSON and the binary ICU resource bundle format (version 2) readable by PHP's `\ResourceBundle` class. For a performance comparison between the two, see my [benchmark](/webmozart/json-res-benchmark). ~~The data is contained in two zip files: json.zip (2.6MB) and rb-v2.zip (3.8MB). The handler~~ ```php \Symfony\Component\Intl\Composer\ScriptHandler::decompressData() ``` ~~needs to be added as Composer hook and decompresses the data after install/update.~~ The data is included as text/binary now. Git takes care of the compression. Before this PR can be merged, I would like to find out what the performance difference between the two formats is in real applications. For that, I need benchmarks from some real-life applications which use ICU data - e.g. in forms (language drop-downs, country selectors etc.) - for both the JSON and the binary data. You can force either format to be used by hard-coding the return value of `Intl::detectDataFormat()` to `Intl::JSON` and `Intl::RB_V2` respectively. I'll also try to create some more realistic benchmarks. If JSON is not significantly slower/takes up significantly more memory than the binary format, we can drop the binary format altogether. Commits ------- be819c1 [Intl] Integrated ICU data into Intl component
Seldaek
pushed a commit
that referenced
this pull request
Nov 12, 2014
This PR was merged into the 2.6-dev branch. Discussion ---------- [Debug] expose object_handle | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This is a small enhancement to the symfony debug C extension that allows fetching an object's handle. This is the `#number` as displayed by var_dump(): `class stdClass**#1** (0) {}` This is required for VarDumper to be able to expose objects' handles and thus have more precise dumps. It will allow inspecting "same" relationships between two *different* dumps. Commits ------- 5f6b676 [Debug] expose object_handle
Seldaek
pushed a commit
that referenced
this pull request
May 11, 2021
…h case insensitive (javiereguiluz) This PR was merged into the 5.3-dev branch. Discussion ---------- [FrameworkBundle] Make debug:event-dispatcher search case insensitive | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - I was playing with the new features of `debug:event-dispatcher` and I thought that making the new search feature case insensitive could be better: ### Before ``` $ php bin/console debug:event-dispatcher mailer [WARNING] The event "mailer" does not have any registered listeners. ``` ### After ``` $ php bin/console debug:event-dispatcher mailer Registered Listeners of Event Dispatcher "debug.event_dispatcher" for "Symfony\Component\Mailer\Event\MessageEvent" Event ========================================================================================================================= ------- --------------------------------------------------------------------------- ---------- Order Callable Priority ------- --------------------------------------------------------------------------- ---------- #1 Symfony\Component\Mailer\EventListener\MessageListener::onMessage() 0 #2 Symfony\Component\Mailer\EventListener\EnvelopeListener::onMessage() -255 #3 Symfony\Component\Mailer\EventListener\MessageLoggerListener::onMessage() -255 ------- --------------------------------------------------------------------------- ---------- ``` Commits ------- 1e4c7d9 [FrameworkBundle] Make debug:event-dispatcher search case insensitive
fabpot
pushed a commit
that referenced
this pull request
Feb 12, 2022
… on denormalization (JustDylan23) This PR was squashed before being merged into the 6.0 branch. Discussion ---------- [Serializer] Fix AbstractObjectNormalizer TypeError on denormalization | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony#44872 | License | MIT | Doc PR | When using dependency injection to get the serializer (instead of manually instantiating it) the object normalizer that is injected into that serializer throws a value exception when doing denormalizing the following: ```php class ObjectOuter { public ObjectInner $inner; } class ObjectInner { public $foo; } public function testDenormalizeRecursiveWithObjectAttributeWithStringValue() { $extractor = new ReflectionExtractor(); $normalizer = new ObjectNormalizer(null, null, null, $extractor); $serializer = new Serializer([$normalizer]); $obj = $serializer->denormalize(['inner' => 'foo'], ObjectOuter::class); $this->assertInstanceOf(ObjectInner::class, $obj->getInner()); } ``` This throws ```php TypeError: Symfony\Component\Serializer\Normalizer\AbstractNormalizer::prepareForDenormalization(): Argument #1 ($data) must be of type object|array|null, string given, called in /var/www/symfony/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php on line 368 at vendor/symfony/serializer/Normalizer/AbstractNormalizer.php:299 at Symfony\Component\Serializer\Normalizer\AbstractNormalizer->prepareForDenormalization('test string') (vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:368) at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize('test string', 'App\\Entity\\User', null, array('cache_key' => 'c93a6d4efa206ea58a62cc6b7fab8dfb', 'deserialization_path' => 'author')) (vendor/symfony/serializer/Serializer.php:238) at Symfony\Component\Serializer\Serializer->denormalize('test string', 'App\\Entity\\User', null, array('cache_key' => 'c93a6d4efa206ea58a62cc6b7fab8dfb', 'deserialization_path' => 'author')) (vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:559) at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->validateAndDenormalize(array(object(Type)), 'App\\Entity\\Blog', 'author', 'test string', null, array('cache_key' => '44db5a926a1544b1a8585af40107ca3a', 'deserialization_path' => 'author')) (vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:401) at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize(array('author' => 'test string'), 'App\\Entity\\Blog', null, array('cache_key' => '44db5a926a1544b1a8585af40107ca3a')) (vendor/symfony/serializer/Serializer.php:238) at Symfony\Component\Serializer\Serializer->denormalize(array('author' => 'test string'), 'App\\Entity\\Blog') (src/Controller/BugReproductionController.php:18) at App\Controller\BugReproductionController->test(object(Serializer)) (vendor/symfony/http-kernel/HttpKernel.php:152) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:74) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:202) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35) at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() (vendor/autoload_runtime.php:29) at require_once('/var/www/symfony/vendor/autoload_runtime.php') (public/index.php:5) ``` Refer to: symfony#44881 for the description. Was in the middle of changing the base branch and accidentally pushed when the branch was deleted. `@fancyweb` I implemented the requested changes Commits ------- 89092ea [Serializer] Fix AbstractObjectNormalizer TypeError on denormalization
fabpot
added a commit
that referenced
this pull request
Feb 12, 2022
…s (xesxen) This PR was merged into the 5.4 branch. Discussion ---------- [RateLimiter] Resolve crash on near-round timestamps | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Occasionally timestamps will be fully round (eg. 1234567890.000000) or close to it (eg. 1234567890.000031). When converting those specific float timestamps to string in SlidingWindow (due to `DateTimeImmutable::createFromFormat`), the number is formatted by PHP without any digits. This causes the resulting value of SlidingWindow::getRetryAfter() to be violated with the boolean value `false`. This patch formats the float to include the decimal digits. ``` Return value of Symfony\Component\RateLimiter\Policy\SlidingWindow::getRetryAfter() must be an instance of DateTimeImmutable, bool returned #0 .../vendor/symfony/rate-limiter/Policy/SlidingWindowLimiter.php(84): Symfony\Component\RateLimiter\Policy\SlidingWindow->getRetryAfter() #1 .../usercode.php(123): Symfony\Component\RateLimiter\Policy\SlidingWindowLimiter->consume(1) ``` Commits ------- 4965952 [RateLimiter] Resolve crash on near-round timestamps
wouterj
pushed a commit
that referenced
this pull request
Jul 24, 2022
…tpCache (mpdude) This PR was merged into the 4.4 branch. Discussion ---------- [HttpKernel] Fix a PHP 8.1 deprecation notice in HttpCache | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | PHP 8.1 may trigger a deprecation notice `PHP Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in .../symfony/http-kernel/HttpCache/HttpCache.php on line 721` The reason is that `$entry->getTtl()` may return `null` for cache entries where no freshness information is present. I think we would err on the safe side by not using stale-while-revalidate behaviour in this case. Commits ------- d0955c2 [HttpKernel] Fix a PHP 8.1 deprecation notice in HttpCache
wouterj
pushed a commit
that referenced
this pull request
Jul 24, 2022
…in `NativeSessionStorage::save()` (chalasr) This PR was merged into the 4.4 branch. Discussion ---------- [HttpFoundation] Fix TypeError on null `$_SESSION` in `NativeSessionStorage::save()` | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - When sending concurrent requests via ajax async to a route pointing to a controller requiring an authenticated user through a stateful - session-based - firewall that calls `SessionInterface::save()`, it happens that `$_SESSION` is `null` under some conditions which causes the following error on PHP 8.1: > Exception 'TypeError' with message 'array_keys(): Argument #1 ($array) must be of type array, null given' in /app/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:246 …app/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php (246) …age::save called at /app/vendor/symfony/http-foundation/Session/Session.php (198) The issue prevents me from upgrading to PHP 8.1 in a project I'm working on with `@jwage`. Commits ------- 05f3e77 [HttpFoundation] Fix TypeError on null `$_SESSION` in `NativeSessionStorage::save()`
Seldaek
pushed a commit
that referenced
this pull request
May 31, 2024
This PR was merged into the 5.4 branch. Discussion ---------- [Process] Fixed inconsistent test | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT Sometimes the process no longer appears to be running when the signal is sent which causes a LogicException to be thrown. This doesn't appear to be consistent and I can reproduce it randomly on my local machine. To avoid having tests fail at random I decided that it's better to send the signal only if the process is still marked as running. ```bash amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php PHP Fatal error: Uncaught Symfony\Component\Process\Exception\LogicException: Cannot send signal on a non running process. in /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php:1502 Stack trace: #0 /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php(516): Symfony\Component\Process\Process->doSignal() #1 /home/amne/work/projects/symfony/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php(28): Symfony\Component\Process\Process->signal() #2 {main} thrown in /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php on line 1502 ``` Commits ------- 00ee4ca [Process] Fixed inconsistent test
Seldaek
pushed a commit
that referenced
this pull request
May 31, 2024
…read from socket (xdanik) This PR was merged into the 5.4 branch. Discussion ---------- [Mailer] Throw `TransportException` when unable to read from socket | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? |no | Issues | None | License | MIT We are seeing error `fgets(): SSL: Connection reset by peer` multiple times a day from connection to Office 365 SMTP server (smtp.office365.com:587). It's certainly related to some kind of timeout as we are sending emails from long running queue dispatcher and error shows up only occasionally and never with the first message. We are not seeing this issue with any other SMTP server, but we have not tested much past smtp.mandrillapp.com and local MailHog. We have tried adjusting the `$pingThreshold` and `$restartThreshold` options, but without much success (well `$restartThreshold = 1` resolves the issue, but it also forces the transport to close connection after each message). Stack trace: ``` #0 /var/www/vendor/symfony/mailer/Transport/Smtp/Stream/AbstractStream.php(77): fgets(Resource(stream)) #1 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(315): Symfony\Component\Mailer\Transport\Smtp\Stream\AbstractStream->readLine() #2 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(181): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->getFullResponse() #3 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(140): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->executeCommand("RSET ", Array(1)) symfony#4 /var/www/vendor/symfony/mailer/Mailer.php(45): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->send(Object(Symfony\Component\Mime\Email), Null) symfony#5 (our queue dispatcher): Symfony\Component\Mailer\Mailer->send(Object(Symfony\Component\Mime\Email)) ``` App is running on PHP 8.0.28 on Debian Linux x64, Mailer v5.4.22. I would gladly written some tests for this, but I don't know how to simulate calls to low-level stream functions like fgets. Commits ------- 44d5b57 [Mailer] Throw TransportException when unable to read from socket
Seldaek
pushed a commit
that referenced
this pull request
Sep 5, 2024
…rsimpsons) This PR was merged into the 5.4 branch. Discussion ---------- [Yaml] 🐛 throw ParseException on invalid date | Q | A | ------------- | --- | Branch? | 5.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | None <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT (found in symfony-tools/docs-builder#179) When parsing the following yaml: ``` date: 6418-75-51 ``` `symfony/yaml` will throw an exception: ``` $ php main.php PHP Fatal error: Uncaught Exception: Failed to parse time string (6418-75-51) at position 6 (5): Unexpected character in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php:714 Stack trace: #0 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(714): DateTimeImmutable->__construct() #1 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(312): Symfony\Component\Yaml\Inline::evaluateScalar() #2 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(80): Symfony\Component\Yaml\Inline::parseScalar() #3 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(790): Symfony\Component\Yaml\Inline::parse() symfony#4 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(341): Symfony\Component\Yaml\Parser->parseValue() symfony#5 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(86): Symfony\Component\Yaml\Parser->doParse() symfony#6 /tmp/symfony-yaml/vendor/symfony/yaml/Yaml.php(77): Symfony\Component\Yaml\Parser->parse() symfony#7 /tmp/symfony-yaml/main.php(8): Symfony\Component\Yaml\Yaml::parse() symfony#8 {main} thrown in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php on line 714 ``` This is because the "month" is invalid. Fixing the "month" will trigger about the same issue because the "day" would be invalid. With the current change it will throw a `ParseException`. Commits ------- 6d71a7e 🐛 throw ParseException on invalid date
Seldaek
pushed a commit
that referenced
this pull request
Oct 4, 2024
…nse from transport (ZhukV) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Notifier][TurboSMS] Process partial accepted response from transport | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | None | License | MIT TurboSMS can return `null` as message id, if sms not sent to recipient. Example: ```json { "response_code": 802, "response_status": "SUCCESS_MESSAGE_PARTIAL_ACCEPTED", "response_result": [ { "phone": "recipient_1", "response_code": 406, "message_id": null, "response_status": "NOT_ALLOWED_RECIPIENT_COUNTRY" }, { "phone": "recipient_2", "response_code": 0, "message_id": "f83f8868-5e46-c6cf-e4fb-615e5a293754", "response_status": "OK" } ] } ``` And we receive error: ``` Symfony\Component\Notifier\Message\SentMessage::setMessageId(): Argument #1 ($id) must be of type string, null given, called in /code/vendor/symfony/turbo-sms-notifier/TurboSmsTransport.php on line 93 ``` Symfony use only one phone number for sent, as result we check only first `response_result`. Commits ------- 932dbe3 [Notifier][TurboSMS] Process partial accepted response from transport
Seldaek
pushed a commit
that referenced
this pull request
Apr 3, 2025
Without the fix running `SYMFONY_PHPUNIT_SKIPPED_TESTS='phpunit.skipped' php ./phpunit src/Symfony/Component/Lock/Tests/Store/DoctrineDbalPostgreSqlStoreTest.php` without the pdo_pgsql extension enabled the generated skip file looked like this: ``` <?php return array ( 'PHPUnit\\Framework\\DataProviderTestSuite' => array ( 'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest::testInvalidDriver' => 1, ), 'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' => array ( 'testSaveAfterConflict' => 1, 'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1, 'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1, 'testSave' => 1, 'testSaveWithDifferentResources' => 1, 'testSaveWithDifferentKeysOnSameResources' => 1, 'testSaveTwice' => 1, 'testDeleteIsolated' => 1, 'testBlockingLocks' => 1, 'testSharedLockReadFirst' => 1, 'testSharedLockWriteFirst' => 1, 'testSharedLockPromote' => 1, 'testSharedLockPromoteAllowed' => 1, 'testSharedLockDemote' => 1, ), ); ``` Thus, running the tests again with the extension enabled would only run 14 tests instead of the expected total number of 16 tests. With the patch applied the generated skip file looks like this: ``` <?php return array ( 'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' => array ( 'testInvalidDriver with data set #0' => 1, 'testInvalidDriver with data set #1' => 1, 'testSaveAfterConflict' => 1, 'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1, 'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1, 'testSave' => 1, 'testSaveWithDifferentResources' => 1, 'testSaveWithDifferentKeysOnSameResources' => 1, 'testSaveTwice' => 1, 'testDeleteIsolated' => 1, 'testBlockingLocks' => 1, 'testSharedLockReadFirst' => 1, 'testSharedLockWriteFirst' => 1, 'testSharedLockPromote' => 1, 'testSharedLockPromoteAllowed' => 1, 'testSharedLockDemote' => 1, ), ); ```
Seldaek
pushed a commit
that referenced
this pull request
Apr 3, 2025
… providers (xabbuh) This PR was merged into the 5.4 branch. Discussion ---------- [PhpUnitBridge] fix dumping tests to skip with data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT Without the fix running `SYMFONY_PHPUNIT_SKIPPED_TESTS='phpunit.skipped' php ./phpunit src/Symfony/Component/Lock/Tests/Store/DoctrineDbalPostgreSqlStoreTest.php` without the `pdo_pgsql` extension enabled the generated skip file looked like this: ``` <?php return array ( 'PHPUnit\\Framework\\DataProviderTestSuite' => array ( 'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest::testInvalidDriver' => 1, ), 'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' => array ( 'testSaveAfterConflict' => 1, 'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1, 'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1, 'testSave' => 1, 'testSaveWithDifferentResources' => 1, 'testSaveWithDifferentKeysOnSameResources' => 1, 'testSaveTwice' => 1, 'testDeleteIsolated' => 1, 'testBlockingLocks' => 1, 'testSharedLockReadFirst' => 1, 'testSharedLockWriteFirst' => 1, 'testSharedLockPromote' => 1, 'testSharedLockPromoteAllowed' => 1, 'testSharedLockDemote' => 1, ), ); ``` Thus, running the tests again with the extension enabled would only run 14 tests instead of the expected total number of 16 tests. With the patch applied the generated skip file looks like this: ``` <?php return array ( 'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' => array ( 'testInvalidDriver with data set #0' => 1, 'testInvalidDriver with data set #1' => 1, 'testSaveAfterConflict' => 1, 'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1, 'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1, 'testSave' => 1, 'testSaveWithDifferentResources' => 1, 'testSaveWithDifferentKeysOnSameResources' => 1, 'testSaveTwice' => 1, 'testDeleteIsolated' => 1, 'testBlockingLocks' => 1, 'testSharedLockReadFirst' => 1, 'testSharedLockWriteFirst' => 1, 'testSharedLockPromote' => 1, 'testSharedLockPromoteAllowed' => 1, 'testSharedLockDemote' => 1, ), ); ``` Commits ------- 95f41cc fix dumping tests to skip with data providers
Seldaek
pushed a commit
that referenced
this pull request
Apr 3, 2025
… not throw exception (lyrixx) This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] Ensure `HttpCache::getTraceKey()` does not throw exception | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT We have such logs in our logs. It's in our raw PHP logs. They are not caught by monolog, it's too early ``` [11-Oct-2024 01:23:33 UTC] PHP Fatal error: Uncaught Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException: Invalid method override "__CONSTRUCT". in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php:1234 Stack trace: #0 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(728): Symfony\Component\HttpFoundation\Request->getMethod() #1 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(207): Symfony\Component\HttpKernel\HttpCache\HttpCache->getTraceKey() #2 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/Kernel.php(188): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle() #3 /var/www/redirection.io/backend/blue/web/app.php(9): Symfony\Component\HttpKernel\Kernel->handle() symfony#4 {main} thrown in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php on line 1234 ``` I managed to reproduced locally. * Before the patch, without the http_cache, symfony returns a 405 * After the patch, without the http_cache, symfony returns a 405 * Before the patch, with the http_cache, symfony returns a 500, without any information (too early) * After the patch, with the http_cache, symfony returns a 405 Commits ------- a2ebbe0 [HttpKernel] Ensure HttpCache::getTraceKey() does not throw exception
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The BC break is removed, additional
terminate()
delegation and tests were added.As discussed on IRC with @stof and @Seldaek.