Why does cli_set_process_title sometimes change the wrong process' title?

[email protected] Sun, 12 Apr 2020 11:29:55 +0200 (CEST)
Newsgroups gmane.comp.php.windows
Message-ID <[email protected]>
------=_Part_158601_382779242.1586683795083
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

I currently only run PHP on Windows, so I have no idea if the same thing happens on the other platforms.

I frequently call cli_set_process_title() in my CLI PHP scripts to set the "process title". Normally, there are no problems at all.

However, on at least two separate occasions, the last time yesterday, something very strange happened at some unknown point: one of the cli_set_process_title() calls changed the process title of a completely different process/window: the PHP built-in webserver one!

I start both the built-in PHP webserver and my own PHP CLI scripts with .bat files. My CLI PHP scripts end up in the cmd.exe group in the Taskbar.

How can this be technically and logically possible? Is it a known issue? Is it known why and when this happens? I have no idea how I'd reproduce it since it rarely does this, but once it has done so, the process/window in question keeps its title forever, until I close it and restart it. (Which of course spawns a new process.)

This really frustrates me, because it's such a weird bug/glitch.

------=_Part_158601_382779242.1586683795083--