Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DIC] Add a split env var processor#31867

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Orkin wants to merge1 commit intosymfony:4.4fromOrkin:explode_env_processor

Conversation

@Orkin
Copy link
Contributor

@OrkinOrkin commentedJun 5, 2019
edited
Loading

QA
Branch?4.4
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PRsymfony/symfony-docs#11674

This adds a newexplode processor that will explode astring to aPHP array

@nicolas-grekas
Copy link
Member

I think you should use thecsv processor instead.

@nicolas-grekasnicolas-grekas added this to thenext milestoneJun 5, 2019
@OskarStark
Copy link
Contributor

This feature should go in4.4 branch instead ofmaster, same for the corresponding docs PR please 🙏

@ro0NL
Copy link
Contributor

Agree with@nicolas-grekas , you can already use thecsv processor:https://3v4l.org/iGdpS

@OrkinOrkin changed the base branch frommaster to4.4June 7, 2019 13:18
@OrkinOrkinforce-pushed theexplode_env_processor branch from44461c1 toe9fea7cCompareJune 7, 2019 13:33
@Orkin
Copy link
ContributorAuthor

@OskarStark base branch updated ;)

OskarStark reacted with thumbs up emoji

@OskarStark
Copy link
Contributor

@Orkin can you please give us some more insights, why you cannot/wont use thecsv processor?

Thank you

@ro0NL
Copy link
Contributor

ro0NL commentedJun 14, 2019
edited
Loading

i realized there can be different behavior :)https://3v4l.org/gOCPR

that's escaping support out-of-the box 😅 but perhaps that works counter-wise for@Orkin

for thecsv processor itself, from the example above; im not sure why PHP doesnt unescaped\",\"e

So for the default parameter values "" and \" have the same meaning. (https://php.net/str_getcsv)

Perhaps SF should fix it?

@nicolas-grekas
Copy link
Member

@ro0NL same as in#32007? Worth a PR on the csv process? Please submit a PR if you think so.
But anyway, we're missing feedback from@Orkin before we can make guesses.

@ro0NL
Copy link
Contributor

not sure if#32007 is related, as it fixes the encoding ofbool(true) into"1". AFAIK Serializer doesnt decode"1" back intobool(true). Nor does PHP:https://3v4l.org/YckLo

For DI it'sbool:key:N:csv:ENV IMHO.

If we decide to unescape the escape char, both DI + Serializer should do that yes. (Unless the escape char is":https://3v4l.org/lgrDY)

https://bugs.php.net/bug.php?id=55413 is the bug report.

@Orkin
Copy link
ContributorAuthor

Orkin commentedJun 14, 2019
edited
Loading

Hi,@OskarStark@nicolas-grekas first of all because I didn't know the csv processor. For my usecase it's for memcached server list retrieve via environment variable so for my need it's easier to split by something.
I choose a comma, but perhaps in the future it can be aspace or a pipe|. It can be usefull to separate csv processor to a real flat array string and to get the availability to specify the separator.

I don't know as much env var processor so I don't have any ideas if it's possible and if not what kind of format it can be used. But in the future it can be a improvement.

And last thing, I don't want my string to be escaped because it can be url or something that need to stay in the same format

@OskarStark
Copy link
Contributor

In this case it makes sense to me to not use the csv processor and got with the new explode one. Also from a DX perspective, having csv:MEMCACHED_HOSTS... looks weird

@ro0NL
Copy link
Contributor

Id prefersplit then 👍

@OskarStark
Copy link
Contributor

Sounds good to me, but I think it’s more common to use explode kn the php context, also because of split is an old PHP 5.3 deprecated method

https://www.php.net/manual/en/function.split.php

But definitely better then using csv here 👍🏻

@ro0NL
Copy link
Contributor

ro0NL commentedJun 14, 2019
edited
Loading

that's the thing, explode sounds PHP specific whereas in SF DI config it should be more language agnostic IMHO. Agreecsv might look weird.

split by something. I choose a comma , but perhaps in the future it can be a space or a pipe |

i think having bothsplit:ENV as well assplit:|:CSV seems sensible 👍

@Orkin
Copy link
ContributorAuthor

It didn’t know and find thecsv processor because it seems to me weird for my use case.
I’m agree withsplit because it’s a more common word but we are in a PHP world so most of the users of SF are PHP developers and when a PHP developer want to transform a string into an array the first function in his mind isexplode that’s why it seems better to me.
We can imagine someone typing something like that in googlehow to explose an array in symfony yaml config

@ro0NL
Copy link
Contributor

ro0NL commentedJun 14, 2019
edited
Loading

maybecsv is weird because of#25627 (comment), currently it accepts a single row, so it's somewhatsplit_escaped:ENV actually

i tend to believe people associate "CSV" with a collection of rows

explode vs.split: the latter is shorter.

OskarStark and Orkin reacted with thumbs up emoji

@OskarStark
Copy link
Contributor

Let’s go with split then

Orkin reacted with rocket emoji

@OrkinOrkinforce-pushed theexplode_env_processor branch frome9fea7c to475d11bCompareJune 14, 2019 18:52
@Orkin
Copy link
ContributorAuthor

Orkin commentedJun 14, 2019
edited
Loading

Everything is up to date ;)

OskarStark reacted with rocket emoji

@OskarStark
Copy link
Contributor

Please update the PR title

Orkin reacted with thumbs up emoji

@OrkinOrkin changed the title[DIC] Add a explode env var processor[DIC] Add a split env var processorJun 15, 2019
@fabpot
Copy link
Member

Not sure we need yet another processor.csv works for most cases (even if not easily discoverable), andjson works for more complex cases.

Here, I'm sure some will want to have another separator than,, and others will want to be able to escape the separator.

So, I'm 👎 for this addition.

@nicolas-grekas
Copy link
Member

Closing as explained, thanks for proposing.

fabpot added a commit that referenced this pull requestSep 30, 2019
This PR was squashed before being merged into the 3.4 branch (closes#32051).Discussion----------[Serializer] Add CsvEncoder tests for PHP 7.4| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | no| New feature?  | no| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? |no| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Some CSV encoder tests to show the broken behavior of a trailing slash. Spotted in#31867, not sure what to do with it :)Commits-------760354d [Serializer] Add CsvEncoder tests for PHP 7.4
@nicolas-grekasnicolas-grekas modified the milestones:next,4.4Oct 27, 2019
hultberg pushed a commit to hultberg/symfony that referenced this pull requestSep 17, 2021
This PR was squashed before being merged into the 3.4 branch (closessymfony#32051).Discussion----------[Serializer] Add CsvEncoder tests for PHP 7.4| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | no| New feature?  | no| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? |no| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Some CSV encoder tests to show the broken behavior of a trailing slash. Spotted insymfony#31867, not sure what to do with it :)Commits-------760354d [Serializer] Add CsvEncoder tests for PHP 7.4
@OrkinOrkin deleted the explode_env_processor branchDecember 20, 2021 13:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

6 participants

@Orkin@nicolas-grekas@OskarStark@ro0NL@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp