? ? Failure

User tests: Successful: Unsuccessful:

avatar bahl24
bahl24
22 Mar 2019

Pull Request for Issue - Fixes Expected 'string' found 'int' error in com_content. .

Summary of Changes

Changed to string

Expected result

string type

Actual result

int type

avatar bahl24 bahl24 - open - 22 Mar 2019
avatar bahl24 bahl24 - change - 22 Mar 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2019
Category Administration com_content
avatar rdeutz rdeutz - change - 22 Mar 2019
Labels Added: ?
avatar SharkyKZ
SharkyKZ - comment - 22 Mar 2019

Judging by the PR that added button classes (#18501), value typehints were added by mistake and should be removed. @asika32764?

avatar Hackwar
Hackwar - comment - 23 Mar 2019

I too think that this is not the right approach and we should rather fix the method than to mask this like this.

avatar asika32764
asika32764 - comment - 23 Mar 2019

When I writing this method I think state value will be loaded from SQL so it will often be string.

But for real use, I agree it should remove string type hint.

avatar asika32764
asika32764 - comment - 23 Mar 2019

If change the addState() signature, we should also modify getState()

https://github.com/joomla/joomla-cms/pull/18501/files#diff-72e4f228b49d04896cfdffaa98f94045R131

avatar asika32764
asika32764 - comment - 23 Mar 2019

We have workflow system now, maybe this class should also rewrite to fit workflow.

avatar bahl24
bahl24 - comment - 25 Mar 2019

@asika32764 Are you working on this or should I try to modify the addState() and other functions in a separate PR as there are many other functions with such type hints?

avatar asika32764
asika32764 - comment - 25 Mar 2019

Since I'm joining some serious projects I'm afraid of I will unable to continue work with this function. If someone want to modify this method, just try to pass the test, then I think it will work fine.

avatar bahl24
bahl24 - comment - 25 Mar 2019

Ok, let me try

avatar joomla-cms-bot joomla-cms-bot - change - 31 Mar 2019
Category Administration com_content Administration com_content Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 31 Mar 2019
Category Administration com_content Libraries Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 31 Mar 2019
Title
[4.0]Fix Expected 'string' found 'int' error in com_content
[4.0] Fix Expected 'string' found 'int' error in com_content
avatar franz-wohlkoenig franz-wohlkoenig - change - 31 Mar 2019
Title
[4.0]Fix Expected 'string' found 'int' error in com_content
[4.0] Fix Expected 'string' found 'int' error in com_content
avatar joomla-cms-bot joomla-cms-bot - edited - 31 Mar 2019
avatar wilsonge wilsonge - change - 12 Mar 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-03-12 16:51:08
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 12 Mar 2020
avatar wilsonge
wilsonge - comment - 12 Mar 2020

No action here and I'm still yet to here of anyone else getting the original issue so I'm closing this for now. It can be reopened if we reproduce this in the future.

avatar SharkyKZ
SharkyKZ - comment - 16 Mar 2020

This doesn't cause a real issue now because we don't use strict_types directive. I think this should be changed anyways. We use only integer states (only passed as string if from DB). Do we want to support non-integer states here (for 3rd parties)?

avatar wilsonge
wilsonge - comment - 16 Mar 2020

We should typehint to an integer earlier i assume (and typehint method accordingly)

avatar SharkyKZ
SharkyKZ - comment - 17 Mar 2020

Looks like this won't work because internally Joomla\CMS\Button\ActionButton uses _default as some sort of default state.

$data = $data ?: $this->getState('_default');

avatar wilsonge
wilsonge - comment - 17 Mar 2020

Ugh and that is typehinted to string ?‍♂ . So I guess does someone want to do this but with correct doc blocks?

avatar SharkyKZ
SharkyKZ - comment - 17 Mar 2020

See PR #28380.

Add a Comment

Login with GitHub to post a comment