It's perfectly reasonable to not want unrestricted journalists leaking information about military assets, or possibly getting themselves killed. Most people seem to understand (or at least not care) when Ukraine imposes press restrictions. The question should be, why are people suddenly outraged when Israel does roughly the same thing?
How many journalists does Israel allow in Gaza, anywhere in Gaza? The answer is 0. Worse still is that they appear to directly target journalists for elimination, as became evident when they shot a rocket at a building stairwell that contained only journalists trying to transmit video and then shot a second rocket at the exact same location shortly after to kill any first responders. The entire event, both rocket attacks, was caught on video that made it out of the enclave.
There are journalists operating in Ukraine, but they're either
- embedded/escorted (IDF did a bit of that also)
- in safe ("green") areas far away from fighting (Gaza is too small to really have those; Ukraine is ~1650x larger)
- or just ignoring the laws, and illegally reporting from dangerous yellow or red zones
I skimmed Wikipedia [1] but couldn't find any mention of laws in Ukraine that forbid reporting from certain areas. I see laws forbidding statements of support for Russia, and laws enabling censorship. Maybe I've misunderstood: are you referring to anti-trespassing laws in general, and not specifically about reporters?
[1] https://en.wikipedia.org/wiki/Freedom_of_the_press_in_Ukrain...
> The rules bar journalists from working in so-called “red zones” deemed most dangerous, and require a military press officer’s escort to work in less dangerous yellow zones. Journalists can work freely in green zones.