You have to read the verses in context. Of course we may unburden our hearts to our friends and talk to them, but that is not what these verses are talking about.
18 In the presence of a stranger do nothing that is to be kept secret,
for you do not know what he will divulge.
19 Do not reveal your thoughts to every one,
lest you drive away your good luck.
This is advice about not telling your secrets to strangers, since you don’t know the person and if he will tell your secrets and cause you harm. This is still very good advice, especially in our day and age with the internet and online forums, lol!
In Sirach 19 it is talking about not gossiping and not repeating other conversations. In 13-17 it is warning us not to trust gossip because it may very possibly not be true. Gossip and slander break God’s commandments, and we are warned repeatedly to be careful how we use our tongues.
5 One who rejoices in wickedness will be condemned,
6 and for one who hates gossip evil is lessened.
7 Never repeat a conversation,
and you will lose nothing at all.
8 With friend or foe do not report it,
and unless it would be a sin for you, do not disclose it;
9 for some one has heard you and watched you,
and when the time comes he will hate you.
10 Have you heard a word? Let it die with you.
Be brave! It will not make you burst!
11 With such a word a fool will suffer pangs
like a woman in labor with a child.
12 Like an arrow stuck in the flesh of the thigh,
so is a word inside a fool.
13 Question a friend, perhaps he did not do it;
but if he did anything, so that he may do it no more.
14 Question a neighbor, perhaps he did not say it;
but if he said it, so that he may not say it again.
15 Question a friend, for often it is slander;
so do not believe everything you hear.
16 A person may make a slip without intending it.
Who has never sinned with his tongue?
17 Question your neighbor before you threaten him;
and let the law of the Most High take its course.
If you’re unsure about verses in Scripture, try reading all the context before and after and it will usually make the meaning more clear.