{"action":"created","issue":{"url":"https://api.github.com/repos/tchwork/utf8/issues/44","labels_url":"https://api.github.com/repos/tchwork/utf8/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/tchwork/utf8/issues/44/comments","events_url":"https://api.github.com/repos/tchwork/utf8/issues/44/events","html_url":"https://github.com/tchwork/utf8/issues/44","id":89536183,"number":44,"title":"OwnCloud 8.x problem with patchworks 1.2.2 on rhel/centos 7.x","user":{"login":"paoloB132","id":12694234,"avatar_url":"https://avatars.githubusercontent.com/u/12694234?v=3","gravatar_id":"","url":"https://api.github.com/users/paoloB132","html_url":"https://github.com/paoloB132","followers_url":"https://api.github.com/users/paoloB132/followers","following_url":"https://api.github.com/users/paoloB132/following{/other_user}","gists_url":"https://api.github.com/users/paoloB132/gists{/gist_id}","starred_url":"https://api.github.com/users/paoloB132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paoloB132/subscriptions","organizations_url":"https://api.github.com/users/paoloB132/orgs","repos_url":"https://api.github.com/users/paoloB132/repos","events_url":"https://api.github.com/users/paoloB132/events{/privacy}","received_events_url":"https://api.github.com/users/paoloB132/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-19T11:07:36Z","updated_at":"2015-06-25T08:41:20Z","closed_at":"2015-06-25T08:41:20Z","body":"See issue https://github.com/owncloud/core/issues/16654\r\n\r\nIt seems that some problem are in place with patchworks utf-8 library used by owcloud 8, when on rhel/centos 7.x\r\n\r\nThey call on file owncloud/apps/user_ldap/user_ldap.php\r\n\r\n//find out dn of the user name\r\n```\r\n\t\t$attrs = array($this->access->connection->ldapUserDisplayName, 'dn',\r\n\t\t\t'uid', 'samaccountname');\r\n\t\t$filter = \\OCP\\Util::mb_str_replace(\r\n\t\t\t'%uid', $uid, $this->access->connection->ldapLoginFilter, 'utf-8');\r\n\r\nto define correct dn. But $uid is not correctly returned.\r\n\\OCP\\Util::mb_str_replace calls:\r\n\r\n/**\r\n\t * Replace all occurrences of the search string with the replacement string\r\n\t *\r\n\t * @param string $search The value being searched for, otherwise known as the needle. String.\r\n\t * @param string $replace The replacement string.\r\n\t * @param string $subject The string or array being searched and replaced on, otherwise known as the haystack.\r\n\t * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8\r\n\t * @param int $count If passed, this will be set to the number of replacements performed.\r\n\t * @return string\r\n\t */\r\n\tpublic static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {\r\n\t\treturn(\\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count));\r\n\t}\r\n\r\nWhere \\OC_Helper::mb_str_replace correspond to:\r\n\r\n\t/**\r\n\t * Replace all occurrences of the search string with the replacement string\r\n\t *\r\n\t * @param string $search The value being searched for, otherwise known as the needle.\r\n\t * @param string $replace The replacement\r\n\t * @param string $subject The string or array being searched and replaced on, otherwise known as the haystack.\r\n\t * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8\r\n\t * @param int $count If passed, this will be set to the number of replacements performed.\r\n\t * @return string\r\n\t *\r\n\t */\r\n\tpublic static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {\r\n\t\t$offset = -1;\r\n\t\t$length = mb_strlen($search, $encoding);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\twhile (($i = mb_strrpos($subject, $search, $offset, $encoding)) !== false) {\r\n\t\t\t$subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length);\r\n\t\t\t$offset = $i - mb_strlen($subject, $encoding);\r\n\t\t\t$count++;\r\n\t\t}\r\n\t\treturn $subject;\r\n\t}\r\n```\r\nWhere OC_Helper::mb_substr_replace is:\r\n```\r\n/**\r\n\t * replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.\r\n\t *\r\n\t * @param string $string\r\n\t * @param string $replacement The replacement string.\r\n\t * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.\r\n\t * @param int $length Length of the part to be replaced\r\n\t * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8\r\n\t * @internal param string $input The input string. .Opposite to the PHP build-in function does not accept an array.\r\n\t * @return string\r\n\t */\r\n\tpublic static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {\r\n\t\t$start = intval($start);\r\n\t\t$length = intval($length);\r\n\t\t$string = mb_substr($string, 0, $start, $encoding) .\r\n\t\t\t$replacement .\r\n\t\t\tmb_substr($string, $start + $length, mb_strlen($string, 'UTF-8') - $start, $encoding);\r\n\r\n\t\treturn $string;\r\n\t}\r\n```\r\n\r\nAnd finally mb_substr is part of /utf8/class/Patchwork/PHP/Shim/Mbstring.php  Patchwork library.\r\n\r\nReturned $string is empty.\r\n\r\nSo it seems that Patchworks doesn't work as expected. Have you tested Patchwork on rhel/centos 7 ? Are you aware of possible troubles ?\r\n\r\nRegards,\r\nPaolo.\r\n\r\n\r\n\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/tchwork/utf8/issues/comments/115163440","html_url":"https://github.com/tchwork/utf8/issues/44#issuecomment-115163440","issue_url":"https://api.github.com/repos/tchwork/utf8/issues/44","id":115163440,"user":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"created_at":"2015-06-25T08:41:20Z","updated_at":"2015-06-25T08:41:20Z","body":"Fixed in #47 thank you @paoloB132 "}}