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
[Console] ArgvInput - Short command input using incorrect environment name #26136
Comments
ping @greg-1-anderson this seems to be related to the changes made in #25893, could you please have a look? |
When using short options, Explanation is in the summary of #25825; see also #25825 (comment). |
Is the "empty needle" error happening on current (dev) Symfony code? That shouldn't happen with input of |
Regarding the short options - I did not know that e.g. Having checked, there is no issue when correctly using the short option syntax. This said, in my opinion it would be confusing to suddenly stop "supporting" the incorrect short hand syntax in a patch release. On the empty needle issue, I put a (3.4.4)
(3.4.x-dev 01ccae8)
To answer your questions specifically:
yes (I'm using commit hash 01ccae8)
This is what I see:
Again, sorry I haven't been able to find a reason as to why this is happening. Thanks for your time and help, Chris |
The "support" for
This should definitely be fixed. |
@codereviewvideos I think that the root bug is here:
Is there any reason that you need to pass an empty string as the last element to the parameter to That said, I think it would be reasonable to fix up Symfony so that it does not emit a warning when an empty string is passed to the |
… getParameterOption is passed invalid parameters.
I think we need to reword this one for a minor (by deprecating things we don't want to support) and a major release to avoid all this bugs and to be able to support all the syntax we need to support. WDYT @greg-1-anderson @chalasr ? |
@Simperfit We need to fix that bug where it has been introduced (2.7), new deprecations cannot be added there. If you think something is buggy and should go away in the next major, please consider opening a dedicated discussion. |
This PR was merged into the 3.4 branch. Discussion ---------- Improve the console script - look for the `--env` and `--no-debug` only before a `--` separator, to respect the support for `--` - avoid passing an empty string as parameter option name (which would never match anyway, but causes php warning is some Symfony versions instead of being ignored silently, because of symfony/symfony#26136). Same change than symfony/recipes#367 Commits ------- 126ce57 Improve the console script
…() (greg-1-anderson) This PR was squashed before being merged into the 2.7 branch (closes #26156). Discussion ---------- Fixes #26136: Avoid emitting warning in hasParameterOption() | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26136 | License | MIT | Doc PR | n/a When hasParameterOption / getParameterOption is passed invalid parameters, a warning may be emitted. While the root cause of the warning is an invalid parameter supplied by the caller, earlier versions of Symfony accepted these parameters, which were effectively ignored. In the context of these methods, what I mean by "invalid parameter" is an empty string, which is the correct datatype, but is not ever a useful thing to provide to these methods. Since empty strings here did not cause a problem in previous versions, and since Symfony is used by all sorts of projects for all sorts of purposes, it seems best to continue to be flexible about the parameters accepted by Symfony APIs. Commits ------- b32fdf1 Fixes #26136: Avoid emitting warning in hasParameterOption()
@codereviewvideos does it fix the bug for you ? |
Not to the best of my knowledge, apologies not looked into this at all today. Here's my output from a quick test:
Do you see the same? |
Try 9d3d237 on the 2.7 branch; I'm not sure this commit has made it to 3.4 or other branches. |
Ok - really sorry, as I say, not looked into this at all as of yet. I have a real life issue that's taking precedence currently. I have some 2.x projects around which I will try this on and update. Sorry again for the delay. Chris |
* 2.7: Clean calls to http_build_query() [HttpFoundation] Fix missing "throw" in JsonResponse Improve the documentation of Suppress warning from sapi_windows_vt100_support on stream other than STDIO removed extra-verbose comments Fixes #26136: Avoid emitting warning in hasParameterOption() Added a README entry to the PR template [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser. [DI] Add null check for removeChild
* 2.8: Another PR template tweak [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties Clean calls to http_build_query() [WebProfilerBundle] limit ajax request to 100 and remove the last one [HttpFoundation] Fix missing "throw" in JsonResponse Improve the documentation of Suppress warning from sapi_windows_vt100_support on stream other than STDIO removed extra-verbose comments Fixes #26136: Avoid emitting warning in hasParameterOption() Added a README entry to the PR template [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser. [DI] Add null check for removeChild
* 3.4: [Translation] Process multiple segments within a single unit. Document the container.autowiring.strict_mode option fix custom radios/inputs for checkbox/radio type Another PR template tweak [FrameworkBundle] Add missing XML config for circular_reference_handler. Add tests. fix CS [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties Clean calls to http_build_query() [WebProfilerBundle] limit ajax request to 100 and remove the last one Add support for URL-like DSNs for the PdoSessionHandler [HttpFoundation] Fix missing "throw" in JsonResponse Improve the documentation of Suppress warning from sapi_windows_vt100_support on stream other than STDIO removed extra-verbose comments Fixes #26136: Avoid emitting warning in hasParameterOption() Added a README entry to the PR template [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser. [DI] Add null check for removeChild
* 4.0: [Translation] Process multiple segments within a single unit. Document the container.autowiring.strict_mode option fix custom radios/inputs for checkbox/radio type Another PR template tweak [FrameworkBundle] Add missing XML config for circular_reference_handler. Add tests. fix CS [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties Clean calls to http_build_query() [WebProfilerBundle] limit ajax request to 100 and remove the last one Add support for URL-like DSNs for the PdoSessionHandler removed version in @Final @internal for version < 4.0 [HttpFoundation] Fix missing "throw" in JsonResponse Improve the documentation of Suppress warning from sapi_windows_vt100_support on stream other than STDIO removed extra-verbose comments Fixes #26136: Avoid emitting warning in hasParameterOption() Added a README entry to the PR template [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser. [DI] Add null check for removeChild
Hi guys. @greg-1-anderson I agree with your
but, this case had worked before this fix was merged. At now all commands witch called with I propose the following:
|
Good suggestions, @benbor. See symfony/symfony-docs#9387 and #26378. The changelog has already gone out; perhaps someone can still update that retroactively, though. |
+1 |
* 4.0: [Translation] Process multiple segments within a single unit. Document the container.autowiring.strict_mode option fix custom radios/inputs for checkbox/radio type Another PR template tweak [FrameworkBundle] Add missing XML config for circular_reference_handler. Add tests. fix CS [PropertyInfo] ReflectionExtractor: give a chance to other extractors if no properties Clean calls to http_build_query() [WebProfilerBundle] limit ajax request to 100 and remove the last one Add support for URL-like DSNs for the PdoSessionHandler removed version in @Final @internal for version < 4.0 [HttpFoundation] Fix missing "throw" in JsonResponse Improve the documentation of Suppress warning from sapi_windows_vt100_support on stream other than STDIO removed extra-verbose comments Fixes symfony#26136: Avoid emitting warning in hasParameterOption() Added a README entry to the PR template [HttpFoundation] Add x-zip-compressed to MimeTypeExtensionGuesser. [DI] Add null check for removeChild
There appears to be a bug here, but I haven't been able to figure out a solution.
The phpunit tests pass.
If I run
bin/console cac:cl -e=dev
I'm seeing:The bigger issue is:
In FileLocator.php line 44: The file "/var/www/api.codereviewvideos.dev/app/config/config_=dev.yml" does not exist.
The
=dev
bit being the problem.I tracked this down to the change below in
getParameterOption
.return substr($token, strlen($leading));
Looking at the old code:
return substr($token, $pos + 1);
If I change to:
return substr($token, strlen($leading) + 1);
Then the command completes - but the
strpos
warnings remain.I added the following just before the new
return
on line 321:If I e.g. run the
cache:clear
command again I see:Looks good.
Now if I run the tests I see 8 failures (
provideGetParameterOptionValues
) e.g:One extra thing, this only affects the short options (
-e=dev
), using the longer form (--env=dev
) does not trigger this issue. However, thestrpos(): Empty needle
issue occurs for both long and short form.Sorry I haven't been able to figure this out, but I hope this helps in some way in tracking down the root cause. Thank you for your time.
The text was updated successfully, but these errors were encountered: