fixed handling of heredocs
merged branch fabpot/fix-heredocs (PR #7416)

This PR was submitted for the master branch but it was merged into the 2.2 branch instead (closes #7416).

Commits
-------

6d29979 [ClassLoader] fixed handling of heredocs

Discussion
----------

[ClassLoader] fixed handling of heredocs

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a