-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[#33739] We don't need to require format #3606
Conversation
Raw is already default
👍 to simplification |
Maybe it would make sense to have already a default value specified where we define the |
We could - but does it really matter with the switch having a default case? |
Technically it doesn't matter, and we would still need the default case in the switch statement. For me it's more a bit better codestyle since you see from the beginning that 👍 anyway to this PR 😃 |
Fair enough :) Added it in |
The |
Fixed although I dunno how no one has picked up on this so far :P It's must have been in the component for a while lol |
This issue stemmed from the change at wilsonge@3379503. This just illustrates that it's not clearly coded as the removal of the format bit included the initial |
Thanks for updating the PR @wilsonge. Unfortunately, we have an issue when not specifying a format. Essentially, the entire HTML document is returned with the raw data. One option would be to add @Bakual any thoughts on that change? |
So that's what we did in 3.2 - so if we don't anymore it's a b/c break joomla-cms/components/com_ajax/ajax.php Line 111 in b7ce34a
@piotr-cz was that a mistake in your PR when you did the revamp of com_ajax - or was it intentional (if intentional - why)? |
For the record, I was never a fan of requiring the format parameter, but also didn't fight that change. Regarding b/c, if we can change the component now to not require the format parameter, while still working when it is specified, I wouldn't consider that a b/c issue. But, I suppose you are right that the previous change was a b/c issue, although not likely to affect anyone as it was first included with 3.2. TL;DR: |
I agree with @betweenbrain, I see no need for the requirement on formal parameter. It would not be a b/c issue to drop this requirement as it would not prevent any current implementations from functioning. 👍 |
I kinda meant about the |
Agreed. |
That was probably the reason why format was made required? Especially the The best way would be if we could set the document type to raw during runtime. This used to work in J1.5 but doesn't work anymore since 1.6 I think. |
@wilsonge What do you mean? |
So in the change here: 94a82ca we removed |
Thinking a bit more about this. I think If we default to |
I'm for having the As for closing the application, I wouldn't ever do it (so plugins can add other data to response), but there might be a problem as some plugins just assume full html format and alter the output. I'm not sure if it's still happening. We've had quite a discussion about that in #1960 |
It shouldn't be a b/c break. Currently if you don't pass the format, you get an error. Afterwards you'll get a HTML response. |
oh yeah. |
Tbf the very first version of the plugin defaulted to raw. That was part of what #1960 did - so it could be a b/c change. I dunno |
Yeah, and that didn't work, right? And thus we made the format parameter required and throwing and error if not given. So the BC was done then. |
It did work. #1960 initially was just making the json response use JReponseJson instead of just using json_encode on the results. It scope then got expanded to be a more major refactoring. |
Ah true, the |
In my opinion, if we can't default to a more usable format like raw of JSON, I'd just assume leave things as they are then. By returning HTML, when the format parameter is omitted, the page will simply look broken to the end user and no meaningful message will ever get displayed. I'd rather the end user be informed of what is wrong. I'd prefer that we default to raw, if the format parameter was omitted. 🍶 |
Do we want other plugins to do this though? |
Closed as per the comment on the tracker |
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33739&start=0
Raw is already default in the switch/case and therefore isn't needed to be passed in. It also didn't throw an exception on introduction in 3.2 (so technically a b/c break when the exception was introduced)