sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

[Bug] ArrayRepository always overwrites entries when adding

Open edglev opened this issue 1 year ago • 2 comments

What are you really trying to do?

Prevent multiple activities with the same name

Describe the bug

Registering multiples of the same activity does not throw ERROR_ALREADY_EXISTS.

ArrayRepostiory's add method checks a non-existing array with isset($this->prototypes[$name]) and is always false, overwriting entries regardless of $overwrite argument specified

edglev avatar Mar 04 '24 12:03 edglev

Also stumbled upon this.

Actually this add() method never takes into account second parameter:

  /**
   * Register a new {@see Identifiable} inside the repository.
   */
  public function add(Identifiable $entry, bool $overwrite = false): void;

I see that in many places it's passed as false explicitly, and in some places it's just omitted. Yet, I've never seen it to be true.

Though, current behavior is as if it always was true 😐

rela589n avatar May 24 '25 08:05 rela589n

Hi, @wolfy-j ,

This is quite sever bug, since right now it tolerates naming collisions basically everywhere (including workflow names, activity names, worker task queues, etc.)

rela589n avatar Jun 05 '25 13:06 rela589n