* Enforce the ban on is_resource in phpcs
* In OrderedStreamingForkController, the comment was incorrect. I
confirmed using a small test script that if the child closes one end
of a socket pair, the other end will still be open, and is_resource()
will still return true, and fclose() will not fail. The issue was
introduced in c82d30d19c, it was not present in the
CirrusSearch copy of the class.
* Allow is_resource() for debug logging.
* Allow is_resource() for parameter validation where a stream may be
passed to a function, since there is no alternative.
Bug: T260735
Change-Id: I59a752f7bb4b043ddfb2434b52a02f9221bf54db
Follows-up c94dea7029.
* Avoid strlen() where a strict check suffices.
* Use substr() for both comparison and stripping, avoid
potentially expensive, but also fragile, because strlen()-1
can produce $str[-1], which would
> PHP Notice: Uninitialized string offset: -1
Luckily, the implied null would work as expected, given that
`null !== "\n"` and produces the same result.
Change-Id: If61e5e412aaa2dc7c00c4441b3b7bd5f04160ec8
The controller should pass through lines of input exactly as
they were provided, only stripping the trailing newline that
delimits items. The trim was making `door` and `door ` equivilant
but for the use case in search the distinction is important.
Additionally check that the line is actually empty, don't throw
away inputs like '0' which are falsy.
Change-Id: Ifac910543fdb46a27da021e831e3e18befefcfc5