Attachment links to email doesn't work in 4.0

We are using this code snippet in our comments template to send
attachments as links rather than actual attachments.

It works fine in 3.8, but fails to work in 4.0. No links appear. When I
modify the last line to say

$res = length($res) ? ’ Attachments: ’ . $res : ’ No attachments.’;

the resulting email shows “No attachments”…

Any RT gurus out there can shed some light on this?

In 2012 we get to choose whether to throw out the baby with the bathwater,
deny that the baby needs a bath, or have the government pay for the baby
and the bathwater.