Surely both are damaged. If only at night the lamp is flashing, it is only the lamp. And if the day and night is on without going out, it is photocell damage.
There is another connection failure, which is not lamp or photocell, in that if the phase cable is inverted with that of the light, the lamp will be on and off all the time.
If it worked normally for a long time, this fault is discarded.