{"action":"closed","issue":{"url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/109","repository_url":"https://api.github.com/repos/dmitryd/typo3-realurl","labels_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/109/comments","events_url":"https://api.github.com/repos/dmitryd/typo3-realurl/issues/109/events","html_url":"https://github.com/dmitryd/typo3-realurl/issues/109","id":144954309,"number":109,"title":"Allow NULL as a return value in user functions","user":{"login":"fgalinski","id":3592787,"avatar_url":"https://avatars.githubusercontent.com/u/3592787?v=3","gravatar_id":"","url":"https://api.github.com/users/fgalinski","html_url":"https://github.com/fgalinski","followers_url":"https://api.github.com/users/fgalinski/followers","following_url":"https://api.github.com/users/fgalinski/following{/other_user}","gists_url":"https://api.github.com/users/fgalinski/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalinski/subscriptions","organizations_url":"https://api.github.com/users/fgalinski/orgs","repos_url":"https://api.github.com/users/fgalinski/repos","events_url":"https://api.github.com/users/fgalinski/events{/privacy}","received_events_url":"https://api.github.com/users/fgalinski/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-31T16:46:23Z","updated_at":"2016-04-03T11:16:30Z","closed_at":"2016-04-03T11:16:30Z","body":"Hi Dmitry,\r\n\r\nI created a patch for your extension, which allows that the return value of a user functions is NULL. This can be necessary if your URL segment doesn't always exists.\r\n\r\n```\r\ndiff --git a/typo3conf/ext/realurl/class.tx_realurl.php b/typo3conf/ext/realurl/class.tx_realurl.php\r\nindex d44d06c..8be35e9 100644\r\n--- a/typo3conf/ext/realurl/class.tx_realurl.php\r\n+++ b/typo3conf/ext/realurl/class.tx_realurl.php\r\n@@ -653,8 +653,12 @@ class tx_realurl extends tx_realurl_baseclass {\r\n \t\t\t\t\t\t\t\t);\r\n \t\t\t\t\t\t\t\t$prevVal = $GETvarVal;\r\n \t\t\t\t\t\t\t\t$GETvarVal = $this->apiWrapper->callUserFunction($setup['userFunc'], $params, $this);\r\n-\t\t\t\t\t\t\t\t$pathParts[] = rawurlencode($GETvarVal);\r\n-\t\t\t\t\t\t\t\t$this->cHashParameters[$GETvar] = $prevVal;\r\n+\t\t\t\t\t\t\t\tif ($GETvarVal === NULL) {\r\n+\t\t\t\t\t\t\t\t\t$this->rebuildCHash |= $parameterSet;\r\n+\t\t\t\t\t\t\t\t} else {\r\n+\t\t\t\t\t\t\t\t\t$pathParts[] = rawurlencode($GETvarVal);\r\n+\t\t\t\t\t\t\t\t\t$this->cHashParameters[$GETvar] = $prevVal;\r\n+\t\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\t} elseif (is_array($setup['lookUpTable'])) {\r\n \t\t\t\t\t\t\t\t$prevVal = $GETvarVal;\r\n \t\t\t\t\t\t\t\t$GETvarVal = $this->lookUpTranslation($setup['lookUpTable'], $GETvarVal);\r\n@@ -1615,6 +1619,10 @@ class tx_realurl extends tx_realurl_baseclass {\r\n \t\t\t\t\t\t\t\t\t'setup' => $setup\r\n \t\t\t\t\t\t\t\t);\r\n \t\t\t\t\t\t\t\t$value = $this->apiWrapper->callUserFunction($setup['userFunc'], $params, $this);\r\n+\t\t\t\t\t\t\t\tif ($value === NULL) {\r\n+\t\t\t\t\t\t\t\t\tarray_unshift($pathParts, $origValue);\r\n+\t\t\t\t\t\t\t\t\tbreak;\r\n+\t\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\t} elseif (is_array($setup['lookUpTable'])) {\r\n \t\t\t\t\t\t\t\t$temp = $value;\r\n \t\t\t\t\t\t\t\t$value = $this->lookUpTranslation($setup['lookUpTable'], $value, TRUE);\r\n```\r\n\r\nI hope you will integrate this patch :)\r\n\r\nKind regards,\r\nFabian"}}