Homogenize getPaths()

see issue #1992
what about 5.3 compatibility ? we can create_funciotn() instead closure