Thanks for your input, Maha.
After a bit of googling, I now believe the sentence in my OP is actually a misquote of the below statement attributed to Khalil Gibran:
(الصديق المزيف كالظل يمشي ورائي عندما أكون في الشمس ويختفي عندما أكون في الظلام.)
Does this version make more sense by itself? If not, do you have access to his works in Arabic, which would allow you to examine the surrounding context?