Are there any advantages between cobblestone wall and regular fence?

Solution 1:

Cobblestone walls have better blast resistance and is not flammable, making it a slightly better defense against creepers and TNT, as well as making it usable near lava or fire.

Other than that, the difference is purely aesthetic.

Solution 2:

Today I discovered, aside from the important and most relevant differences mentioned by fredley, cobblestone walls also have noticeably bigger hitboxes while still retaining the taller-than-a-block effect of normal fences, making them useful in certain situations for mob farms and mob elevators.

For example, baby zombies, having a square hitbox of 0.3 x 0.3 blocks, can squeeze through the corner gap between a fence and two solid blocks of 6/16 = 0.375 blocks, but cannot squeeze through the gap between a wall and solid block when there is a wall post, since the empty area is a 5/16 x 5/16 block square minus 1/16 x 1/16 in the corner taken up by the post, but can squeeze in the 5/16 x 5/16 block area when there is no post (when there are two blocks on either side of the wall or four blocks on all sides). I assume this is well-known by the technical minecraft community but it was a first for me.

baby zombie and fence

baby zombie and wall without post

baby zombie and wall with post

Why is this important? It just so happens I was using a mob elevator with bubble columns that uses a fence to raise mobs up onto the bubble column, and baby zombies were getting stuck in between the fence and solid block (hence the magma block). Using a cobblestone wall with a post, baby zombies cannot get stuck.

mob elevator

There is also a niche redstone use of transmitting a signal downward instantly using the wall's post. See https://www.reddit.com/r/Minecraft/comments/ezlbdd/transmitting_redstone_signal_downwards_fast_using/