Whether or not a speaker works well near the wall depends on the details of the design. While as a general rule of thumb we could say that the average rear-ported speaker would not work well in such situations, there are exceptions that work exceptionally well.
For instance, Audio Note uses rear-porting on speakers specifically designed to go in or near a corner. They use a lower-than-normal tuning frequency. I can think of four reasons why their approach is a good idea.
First, by tuning the port lower than normal the bass boost from corner loading results in deeper bass extension instead of boomy bass.
Second, it is not terribly difficult to shape the low-end response of a reflex enclosure so that it's approximately the inverse of the low-frequency gain from boundary reinforcement. The shape of the low-end response of a sealed box speaker has a much more limited range of adjustment, and the only way to get a reasonably close approximation of the inverse of boundary reinforcement is to use equalization.
Third, lower tuning frequencies call for longer port lengths, and longer ports are more likely to emit some midrange coloration (at a reduced level of course due to damping material inside the box). By directing this undesirable midrange energy away from the listening area, it is less likely to be audible (and in most cases is inaudible).
Fourth, by staggering the distances from the low frequency sources (woofers and ports) to room boundaries in all three planes, the bass is likely to be a bit smoother at the listening position.
I like Audio Note's approach enough that I use a variation thereof in some of my own designs.
In my opinion rear ported speakers specifically designed for (or adaptable to) placement close to the wall can work very well there.
Just for the record, I'm not really an advocate of vented boxes as inherently superior to sealed boxes in the bass region. I do like the greater design flexibility of the vented box, but overall it's a trade-off of one set of compromises versus another. All else being equal, vented box woofers have more powerful magnets than comparable sealed box woofers, and this usually translates into better midrange performance.