Note, https://bugs.php.net/bug.php?id=40459 shows that __construct() not being called in all cases was a bug, and it was fixed in August 2012.
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::__construct — Создаёт новый объект обёртки потока
Вызывается при открытии обёртки потока непосредственно перед вызовом метода streamWrapper::stream_open().
У этой функции нет параметров.
Note, https://bugs.php.net/bug.php?id=40459 shows that __construct() not being called in all cases was a bug, and it was fixed in August 2012.
Just to clarify what was said above, as far as I can tell, __construct is *only* called before stream_open.
It does not get called for other functions such as stream::url_stat or stream::unlink, even though those functions do create a new object.
This behavior is contrary to normal expectations for php object creation. But based on the documentation above I can only assume that it is by design.