Unable to fork when Gravatar disabled

Occurs when "Gravatar enabled" is unticked under Settings->Account and limit CE Version 11.2.0-pre (00c474ae)

==> /var/log/gitlab/production_json.log <==
{"method":"GET","path":"/xy/linux/forks/new","format":"html","controller":"Projects::ForksController","action":"new","status":500,"error":"ActionView::Template::Error: PG::UndefinedFunction: ERROR:  function lower(integer) does not exist\nLINE 1: ..."."source_type" = $1 WHERE ((LOWER(routes.path) = LOWER(546)...\n                                                             ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts.\n: SELECT  "projects".* FROM "projects" INNER JOIN "routes" ON "routes"."source_id" = "projects"."id" AND "routes"."source_type" = $1 WHERE ((LOWER(routes.path) = LOWER(546)))  ORDER BY (CASE WHEN  routes.path = 546 THEN 0 ELSE 1 END) LIMIT 1","duration":26.88,"view":0.0,"db":5.1,"time":"2018-08-13T14:50:52.624Z","params":[{"key":"namespace_id","value":"xy"},{"key":"project_id","value":"linux"}],"remote_ip":"10.244.4.5","user_id":546,"username":"me"}

==> /var/log/gitlab/production.log <==

ActionView::Template::Error (PG::UndefinedFunction: ERROR:  function lower(integer) does not exist
LINE 1: ..."."source_type" = $1 WHERE ((LOWER(routes.path) = LOWER(546)...
^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: SELECT  "projects".* FROM "projects" INNER JOIN "routes" ON "routes"."source_id" = "projects"."id" AND "routes"."source_type" = $1 WHERE ((LOWER(routes.path) = LOWER(546)))  ORDER BY (CASE WHEN  routes.path = 546 THEN 0 ELSE 1 END) LIMIT 1):
18:         class: ("disabled has-tooltip" unless can_create_project),
19:         title: (_('You have reached your project limit') unless can_create_project) do
20:       - if /no_((\w*)_)*avatar/.match(avatar)
21:         = project_icon(namespace, class: "avatar s100 identicon")
22:       - else
23:         .avatar-container.s100
24:           = image_tag(avatar, class: "avatar s100")
app/models/concerns/routable.rb:50:in `find_by_full_path' app/helpers/avatars_helper.rb:116:in`source_icon'
app/helpers/avatars_helper.rb:3:in `project_icon' app/views/projects/forks/_fork_button.html.haml:21:in`block in _app_views_projects_forks__fork_button_html_haml___2925269400606822670_46995058807240'
app/views/projects/forks/_fork_button.html.haml:16:in `_app_views_projects_forks__fork_button_html_haml___2925269400606822670_46995058807240' app/views/projects/forks/new.html.haml:17:in`block in _app_views_projects_forks_new_html_haml___1023091398450606455_46995060656220'
app/views/projects/forks/new.html.haml:16:in `each' app/views/projects/forks/new.html.haml:16:in`_app_views_projects_forks_new_html_haml___1023091398450606455_46995060656220'
lib/gitlab/i18n.rb:51:in `with_locale' lib/gitlab/i18n.rb:57:in`with_user_locale'
app/controllers/application_controller.rb:401:in `set_locale' lib/gitlab/middleware/multipart.rb:97:in`call'
lib/gitlab/request_profiler/middleware.rb:14:in `call' lib/gitlab/middleware/go.rb:17:in`call'
lib/gitlab/etag_caching/middleware.rb:11:in `call' lib/gitlab/middleware/rails_queue_duration.rb:22:in`call'
lib/gitlab/metrics/rack_middleware.rb:15:in `block in call' lib/gitlab/metrics/transaction.rb:53:in`run'
lib/gitlab/metrics/rack_middleware.rb:15:in `call' lib/gitlab/middleware/read_only/controller.rb:38:in`call'
lib/gitlab/middleware/read_only.rb:16:in `call' lib/gitlab/middleware/basic_health_check.rb:25:in`call'
lib/gitlab/request_context.rb:18:in `call' lib/gitlab/metrics/requests_rack_middleware.rb:27:in`call'
lib/gitlab/middleware/release_env.rb:10:in `call'
Edited by Stan Hu