19007[TASK] Use short version ?: in ternary operator (PHP 5.3+)
Commit message
Review
-
Code review CR +2
- Christian Kuhn +2
-
Verified V +2
- Christian Kuhn +2
Issues 1
Files 100
- typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php5+2 −2
- typo3/sysext/backend/Classes/Controller/Wizard/TableController.php1+1 −1
- typo3/sysext/backend/Classes/Controller/BackendController.php1+1 −1
- typo3/sysext/backend/Classes/Controller/EditDocumentController.php1+1 −1
- typo3/sysext/backend/Classes/Controller/LoginController.php+1 −1
- typo3/sysext/backend/Classes/Controller/NewRecordController.php1+3 −3
- typo3/sysext/backend/Classes/Controller/PageLayoutController.php1+1 −1
- typo3/sysext/backend/Classes/Form/Element/InlineElement.php3+3 −3
- typo3/sysext/backend/Classes/Form/Element/SuggestDefaultReceiver.php2+1 −1
- typo3/sysext/backend/Classes/Form/Element/SuggestElement.php1+1 −1
- typo3/sysext/backend/Classes/Form/Element/ValueSlider.php3+2 −2
- typo3/sysext/backend/Classes/Form/FormEngine.php2+7 −7
- typo3/sysext/backend/Classes/History/RecordHistory.php+1 −1
- typo3/sysext/backend/Classes/Module/BaseScriptClass.php1+3 −1
- typo3/sysext/backend/Classes/RecordList/ElementBrowserRecordList.php1+1 −1
- typo3/sysext/backend/Classes/Toolbar/ShortcutToolbarItem.php+1 −1
- typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php+1 −1
- typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php+3 −3
- typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php+1 −1
- typo3/sysext/backend/Classes/Utility/BackendUtility.php1+4 −4
Show 80 more files
- typo3/sysext/backend/Classes/Utility/IconUtility.php1+2 −2
- typo3/sysext/belog/Classes/ViewHelpers/Form/TranslateLabelSelectViewHelper.php+1 −1
- typo3/sysext/beuser/Classes/ViewHelpers/IssueCommandViewHelper.php+1 −1
- typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php+2 −2
- typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php1+1 −1
- typo3/sysext/core/Classes/Charset/CharsetConverter.php+2 −2
- typo3/sysext/core/Classes/Database/DatabaseConnection.php+1 −1
- typo3/sysext/core/Classes/Database/QueryGenerator.php+1 −1
- typo3/sysext/core/Classes/Database/RelationHandler.php+1 −1
- typo3/sysext/core/Classes/Database/SqlParser.php+2 −2
- typo3/sysext/core/Classes/DataHandling/DataHandler.php4+4 −4
- typo3/sysext/core/Classes/Error/Http/StatusException.php+1 −1
- typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php+1 −1
- typo3/sysext/core/Classes/Html/HtmlParser.php1+4 −4
- typo3/sysext/core/Classes/Http/HttpRequest.php+4 −4
- typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php+1 −1
- typo3/sysext/core/Classes/Localization/Parser/LocallangArrayParser.php+1 −1
- typo3/sysext/core/Classes/Log/LogManager.php+1 −1
- typo3/sysext/core/Classes/Mail/Mailer.php+1 −1
- typo3/sysext/core/Classes/Resource/ProcessedFile.php+2 −2
- typo3/sysext/core/Classes/Resource/ResourceStorage.php+1 −1
- typo3/sysext/core/Classes/Resource/StorageRepository.php+1 −1
- typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php1+1 −1
- typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php+3 −3
- typo3/sysext/core/Classes/TypoScript/TemplateService.php+2 −2
- typo3/sysext/core/Classes/Utility/File/BasicFileUtility.php+1 −1
- typo3/sysext/core/Classes/Utility/CommandUtility.php+1 −1
- typo3/sysext/core/Classes/Utility/GeneralUtility.php3+5 −5
- typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php+1 −1
- typo3/sysext/cshmanual/Classes/Controller/HelpModuleController.php+1 −1
- typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php+5 −5
- typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php+2 −2
- typo3/sysext/extensionmanager/Classes/Utility/Importer/ExtensionListUtility.php+5 −5
- typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php+2 −2
- typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php+13 −13
- typo3/sysext/frontend/Classes/ContentObject/Menu/ImageMenuContentObject.php+5 −5
- typo3/sysext/frontend/Classes/ContentObject/Menu/JavaScriptMenuContentObject.php+3 −3
- typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/FlowPlayerContentObject.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/MediaContentObject.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/OffsetTableContentObject.php+3 −3
- typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/SearchResultContentObject.php+1 −1
- typo3/sysext/frontend/Classes/Controller/DataSubmissionController.php+1 −1
- typo3/sysext/frontend/Classes/Controller/ShowImageController.php+2 −2
- typo3/sysext/frontend/Classes/Controller/TranslationStatusController.php+1 −1
- typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php2+9 −9
- typo3/sysext/frontend/Classes/Imaging/GifBuilder.php+3 −3
- typo3/sysext/frontend/Classes/Page/PageGenerator.php1+7 −7
- typo3/sysext/frontend/Classes/Page/PageRepository.php+2 −2
- typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php+4 −4
- typo3/sysext/impexp/Classes/Controller/ImportExportController.php+1 −1
- typo3/sysext/impexp/Classes/ImportExport.php3+5 −5
- typo3/sysext/indexed_search/Classes/Controller/SearchController.php+3 −3
- typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php+3 −3
- typo3/sysext/indexed_search/Classes/Hook/CrawlerHook.php+2 −2
- typo3/sysext/indexed_search/Classes/FileContentParser.php+1 −1
- typo3/sysext/indexed_search/Classes/Indexer.php3+4 −4
- typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php+5 −5
- typo3/sysext/rsaauth/Classes/Hook/UserSetupHook.php+2 −2
- typo3/sysext/rtehtmlarea/Classes/Controller/FrontendRteController.php+10 −10
- typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php+2 −2
- typo3/sysext/rtehtmlarea/Classes/Extension/Acronym.php1+1 −1
- typo3/sysext/rtehtmlarea/Classes/Extension/CopyPaste.php+1 −1
- typo3/sysext/rtehtmlarea/Classes/Extension/Typo3HtmlParser.php+1 −1
- typo3/sysext/rtehtmlarea/Classes/Hook/SoftReferenceHook.php+1 −1
- typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php2+6 −6
- typo3/sysext/rtehtmlarea/Classes/RteHtmlAreaBase.php2+5 −5
- typo3/sysext/rtehtmlarea/Classes/SelectImage.php+1 −1
- typo3/sysext/rtehtmlarea/Classes/User.php+1 −1
- typo3/sysext/rtehtmlarea/ext_localconf.php+2 −2
- typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php1+1 −1
- typo3/sysext/setup/Classes/Controller/SetupModuleController.php1+3 −3
- typo3/sysext/sv/Classes/Report/ServicesListReport.php+3 −3
- typo3/sysext/sys_action/Classes/ActionTask.php+1 −1
- typo3/sysext/t3editor/Classes/Hook/TypoScriptTemplateInfoHook.php+2 −2
- typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php+1 −1
- typo3/sysext/workspaces/Classes/Service/WorkspaceService.php+2 −2
Review log 49
Show 24 earlier messages
-
Stefan Neufeind commented on patch set 1 05/27/13, 17:19
This "cleanup"-ride through the core grew larger than expected. Somebody please have a look over the changes. There are cases where an isset(...) was replaced with the new operator. Those need to be looked at especially since using ?: actually makes the construct behave like using empty() (with all the associated potential problems). Some sysexts are also part of this patch which reside in their own git-repos. Those would of course need to be split out ... -
Stefan Neufeind uploaded patch set 2 05/27/13, 17:19
-
Markus Klein commented on patch set 1 21 comments 05/27/13, 17:19
I would prefer that you didn't submit this Ok, I took the time to review a couple of files and comment all issues. In general I'd like to point out the following result: $t = "00"; echo $t > 0 ? "1" : "0"; #0 echo $t == 0 ? "1" : "0"; #1 echo $t ? "1" : "0"; #1 Whereas: $t = "0"; echo $t > 0 ? "1" : "0"; #0 echo $t == 0 ? "1" : "0"; #1 echo $t ? "1" : "0"; #0 -
Markus Klein commented on patch set 2 11 comments 05/27/13, 17:19
I would prefer that you didn't submit this Partial review. Will continue -
Helmut Hummel commented on patch set 1 1 comment 05/27/13, 17:19
I would prefer that you didn't submit this I agree with Tymek. It's fine for the places where the behavior is not changed, but I would also not touch the places where isset() empty() $foo > 0 or the like is used. -
Tymoteusz Motylewski commented on patch set 1 05/27/13, 17:19
I would prefer that you didn't submit this This change simplifies code in many places, but I would rather make the change only when we are sure it doesn't change behavior. As it might provide a lot of edge case regressions. BTW, empty() behaves differently then boolean casting (like in if($x) ) see: http://php.net/manual/en/types.comparisons.php See inline comments for some examplesclass.t3lib_userauthgroup.php:560it's not the same "-1" is not > 0, but after casting to boolean (bool)"-1" === TRUE, so it changes behaviour.ConditionMatcher.php:244change of behaviour for $x=0; isset($x) will return TRUE, while $x ? will return FALSE -
Mr. Jenkins commented on patch set 1 05/27/13, 17:19
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/7784/ : SUCCESS -
Mr. Jenkins commented on patch set 2 05/27/13, 17:19
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/8684/ : SUCCESS -
Stefan Neufeind uploaded patch set 3 08/19/13, 22:42
-
Mr. Jenkins commented on patch set 3 08/19/13, 22:44
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/10153/ : SUCCESS -
Stefan Neufeind commented on patch set 3 08/19/13, 22:44
needed a complete rebase. did so. Took Markus comments into account which he gave for the first part. Please see again if these changes are okay. It might be that there are some more possible repleacements which I didn't find so far. If somebody sees a way to automatically (?) investigate that would be great. Else I'd say maybe let's review this first batch here first. -
Marcus Krause commented on patch set 3 08/20/13, 12:06
I do not see any benefits in this change but a lot of places where these changes need to thoroughly tested (logic changes) to not introduce regressions. Is it worth it? -
Stefan Neufeind commented on patch set 3 08/20/13, 12:43
The logic-changes are things that need to be reviewed and maybe excluded from the patch if unsure. However for cases like $password ? $password : $be_user_data['p assword'] I feel it's definitely worth (and we're not risking a thing) to use a ternary operator instead. THere are also cases where longer array-names with keys etc. are given so that the first and second part around the question-mark easily span a whole row ... let's make those cases more readable, please. -
Markus Klein commented on patch set 3 08/20/13, 16:50
@Marcus: I didn't review the newest version of the patch yet, but it should NOT contain any logic changes. -
Wouter Wolters commented on patch set 3 08/20/13, 21:19
IMO to risky and don't see the real benefit here. Only the code will get smaller. I will not vote this issue but also not downvote if others wanna take the risk. -
Chris topher updated the commit message in patch set 3 12/11/13, 19:38
-
Mr. Jenkins commented on patch set 4 12/11/13, 19:53
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/12562/ : SUCCESS -
Stefan Neufeind commented on patch set 4 12/18/13, 11:59
Would be great if oyu could please go through this (long but not difficult) changeset before too many merge-conflicts or such arise due to other changes. -
Helmut Hummel commented on patch set 4 12/18/13, 22:53
Boy, this is a massive change. thanks for your work on that.CreatePagesWizardModuleFunctionController.php:86Removing isset() will raise notices -
Helmut Hummel commented on patch set 4 1 comment 12/18/13, 22:58
-
Markus Klein commented on patch set 4 12/18/13, 23:01
Ehmmm. No! ;-)BackendController.php:461Change of behaviour.EditDocumentController.php:1331Change of behaviour. $TSconfig['properties'][$table] = "0" would be FALSE.NewRecordController.php:447Wrong. Triggers Warning if some key is not set.PageLayoutController.php:612This is actually a bug. It must be strlen($cRow['header']) here, since "0" is a valid header of a content element.TableController.php:100Triggers warning if key not set.InlineElement.php:206wrong result if $liveVersionId == 0InlineElement.php:406warningInlineElement.php:1248WarningSuggestDefaultReceiver.php:173wrongSuggestDefaultReceiver.php:190WarningSuggestElement.php:92wrongTreeElement.php:185Parenthesis wrong.TreeElement.php:188(isset($PA['fieldConf']['config']['exclusiveKeys']) ? $PA['fieldConf']['config']['exclusiveKeys'] : '')ValueSlider.php:64WarningValueSlider.php:65WarningValueSlider.php:68isset()FlexFormsHelper.php:77Warning if 'meta' not set in array. (captured by empty)FlexFormsHelper.php:81Warning if 'meta' not set in array. (captured by empty)FlexFormsHelper.php:83Warning if 'meta' not set in array. (captured by empty)FlexFormsHelper.php:129Warning if 'meta' not set in array. (captured by empty)FormEngine.php:879WarningFormEngine.php:1229Actually this has to be !empty().FrontendBackendUserAuthentication.php:147WarningBaseScriptClass.php:278if $MS_value is '' this will change behaviour. Better: if (!is_null($MS_value)) { $MS_value = $this->MOD..... }AbstractRecordList.php:347Change of behaviour if $altId = '0'ElementBrowserRecordList.php:86cob if $altId = '0'DocumentTemplate.php:456Don't change that. $uid is forced to be a valid integer in the original conditionBackendUtility.php:991keep empty pleaseIconUtility.php:583keep issetBackendUserAuthentication.php:718keep the > 0TransientMemoryBackend.php:79keep isset -
Helmut Hummel commented on patch set 4 12/18/13, 23:06
ClickMenu.php:714While this change is functionally equivalent, I ask myself if it wouldn't make sense to make these places notice free, instead which would require not to use the ternary operator but a construct like: isset($rec['_ORIG_uid']) ? $rec['_ORIG_uid'] : $rec['uid'];ClickMenu.php:714ReplyHm, there is a case where this key is set but the value is NULL, '' or 0? Anyway, the question is: Do this change although we might change that back at a later point? -
Stefan Neufeind commented on patch set 4 12/18/13, 23:16
ClickMenu.php:714ReplyI guess that's hard to decide for each case, especially with such a large patch. Have this change as a "functional equivalent" for now maybe and go through parts one-by-one later? If you feel like it, maybe someday start with one class and ask yourself questions like the above mentioned - I expect there are much more similar cases that turn up along the road ... It's imho just not realistic in one such bunch. -
Helmut Hummel commented on patch set 4 12/19/13, 18:17
ClickMenu.php:714ReplyOK. Fine, go ahead. No objections...
-
Stefan Neufeind commented on patch set 4 12/19/13, 18:46
Finally an okay from Helmut for this "beast" (due to it's size). I'd appreciate if you guys could have another look at it and maybe get this out the door if approved. I hope we don't need further review-rounds with loosing all votes over and over again. (Thanks though for all the work/thoughts involved in this patch.) -
Xavier Perseguers commented on patch set 4 CR -1 12/19/13, 18:58
A real beast :) I skipped commenting at a few place where exactly the same comment was needed right after. Not all my comments are the same but "same here" is always related to removing isset() and thus most probably introducing a possible PHP warning. I know that a few places would never introduce a PHP warning because of preconditions but at others places like $_POST[whatever], for sure it introduces a PHP warning so this is the reason for my -1. But very good job!DataHandler.php:1517you convert a isset(X) ? X : Y to X ?: Y so here you clearly introduce a possible PHP warningDataHandler.php:2308same here, i'd say, really not sure maxitems is always setDataHandler.php:3333same hereHtmlParser.php:1077same hereLocales.php:258same hereLocales.php:272same hereIntrospectionProcessor.php:56same hereRfc822AddressesParser.php:597this stinks to have isset($comments), please additionally make sure it is initialized to an empty array, then this construct will certainly go away by itself.PageRenderer.php:2149isset(X) ? X : Y not the same anymore => PHP warningRegistry.php:63same hereTaskTypeRegistry.php:54same hereFrontendContentAdapterService.php:92same hereConfigurationForm.php:219same hereGeneralUtility.php:91same hereGeneralUtility.php:2396same hereGeneralUtility.php:2931you change the behaviour of a public function, before, having $localLimit < 0 would trigger the use of maxFileSizeRootlineUtility.php:220isset(X) ? X : Y => introduce PHP warningFileHandlingUtility.php:202same hereTypoScriptFactory.php:328isset(X) ? X : Y => introduce PHP warningTypoScriptFactory.php:347same hereTypoScriptFactory.php:359same hereRequest.php:192same hereRequest.php:208same hereRequest.php:224same hereFilesContentObject.php:80same hereTypoScriptFrontendController.php:3572isset(X) ? X : Y => introduce PHP warningTypoScriptFrontendController.php:3810same herePageGenerator.php:557same hereImportExport.php:1174same hereImportExport.php:1266same hereImportExport.php:1320same hereIndexSearchRepository.php:127same hereIndexer.php:302same hereIndexer.php:615same hereIndexer.php:1611it's probably better to trim but it's not the same, I guess it's fine anywayAbstractDatabaseRecordList.php:409isset(X) ? X : Y => introduce PHP warningAbstractDatabaseRecordList.php:411same hereSessionStorage.php:56same hereBrowseLinks.php:257same hereBrowseLinks.php:269same hereCustomAttributeController.php:78same hereCustomAttributeController.php:81same hereAcronym.php:129same herePlaintext.php:85same hereRteHtmlAreaBase.php:458same hereRteHtmlAreaBase.php:716same hereSchedulerModuleController.php:1366same hereSetupModuleController.php:446same here -
Helmut Hummel commented on patch set 4 12/19/13, 22:38
Thanks Xavier for catching those issues. Of course adding potential notices to the code does not make sense and must be avoided with this change. -
Stefan Neufeind commented on patch set 4 CR -1 12/19/13, 22:48
I'll go through and remove cases where we are not fully sure it still works identical.DataHandler.php:2368maybe also leave this in here as well? haven't looked what $newValue can actually become. But "0" is not accepted with the new variant, whereas strlen() would be >0 and $newValue accepted. -
Stefan Neufeind uploaded patch set 5 12/19/13, 23:48
-
Stefan Neufeind commented on patch set 5 12/19/13, 23:50
After discussion here, I now went through again and removed all parts which I guess we might (potentially) feel uneasy with, especially also the isset-parts mentioned. This work was done on the patch-file, applied, fixed parts where it didn't apply cleanly anymore *sigh* etc. Please look through again. If you find any change you feel uneasy with, just push a new version immediately. But I hope we're near a goal now. -
Mr. Jenkins commented on patch set 5 CR -1 V -1 12/20/13, 00:00
Build Failed https://ci.typo3.org/job/typo3-v4-core-gerrit/12666/ : FAILURE -
Stefan Neufeind uploaded patch set 6 12/20/13, 00:02
-
Mr. Jenkins commented on patch set 6 12/20/13, 00:15
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/12667/ : SUCCESS -
Stefan Neufeind commented on patch set 6 01/16/14, 23:04
ping? -
Stefan Neufeind commented on patch set 6 01/24/14, 00:00
Would be great if sombeody could take another look at it, and if need be, push a new version immediately if something is still wrong. Last I looked across it I had the feeling we limited the patch meanwhile to cases which are "safe" - but you always find small things the more often you look at it :-) -
Stefan Neufeind commented on patch set 6 01/30/14, 12:53
ping? -
Anja Leichsenring uploaded patch set 7 01/30/14, 13:45
-
Anja Leichsenring commented on patch set 7 V +1 CR +1 01/30/14, 13:54
rebased, read and run tests, Backend is still working after random clicking. So fine with me. -
Mr. Jenkins commented on patch set 7 01/30/14, 13:59
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/13356/ : SUCCESS -
Jigal van Hemert commented on patch set 7 CR +2 01/30/14, 14:15
No testing environment ready (almost up and running), so no vote by testing. -
Stefan Neufeind commented on patch set 7 CR +1 01/30/14, 15:23
thanks for the help -
Christian Kuhn commented on patch set 7 CR -1 01/30/14, 22:26
FrontendEditPanel.php:272unrelated change? -
Stefan Neufeind uploaded patch set 8 01/30/14, 22:36
-
Christian Kuhn uploaded patch set 9 01/30/14, 22:36
-
Christian Kuhn commented on patch set 9 V +1 CR +1 01/30/14, 22:38
uploaded exact same patch twice in same minute ^^ -
Christian Kuhn commented on patch set 9 V +2 CR +2 01/30/14, 22:39
Enough votes, no change except the obvious hunk removed now, go for it. -
Christian Kuhn merged patch set 10 01/30/14, 22:39
-
Mr. Jenkins commented on patch set 8 01/31/14, 03:40
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/13406/ : SUCCESS -
Mr. Jenkins commented on patch set 9 01/31/14, 03:52
Build Successful https://ci.typo3.org/job/typo3-v4-core-gerrit/13407/ : SUCCESS