I had a broken toilet flange too. The cause was a sagging OSB platformed, water-damaged from leaks, which allowed the weight of the toilet (and its occupants) to flex the plastic until it broke. When I rebuilt the platform for the new flange, I reinforced it with 2x lumber.
One thing to look for with the new flange, assuming you are using a threaded one that screws to the pipe, is to get the right components so that the flange is the male part of the threaded connection. From the factory, mine was the opposite. The female-threaded flange screwed to the outside of the pipe, ensuring that any leak past the threads went into the floor and the waste-tank bay below. Stupid...
2000 HR Endeavor 40PBD, Freightliner XC, CAT 3126B