File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ public function open()
218218 throw new TTransportException ('Cannot open null host ' , TTransportException::NOT_OPEN );
219219 }
220220
221- if ($ this ->port_ <= 0 ) {
221+ if ($ this ->port_ <= 0 && strpos ( $ this -> host_ , ' unix:// ' ) !== 0 ) {
222222 throw new TTransportException ('Cannot open without port ' , TTransportException::NOT_OPEN );
223223 }
224224
Original file line number Diff line number Diff line change @@ -246,6 +246,33 @@ public function testOpenPersist()
246246 $ this ->assertTrue ($ transport ->isOpen ());
247247 }
248248
249+ public function testOpenUnixSocket ()
250+ {
251+ $ host = 'unix:///tmp/ipc.sock ' ;
252+ $ port = -1 ;
253+ $ persist = false ;
254+ $ debugHandler = null ;
255+
256+ $ this ->getFunctionMock ('Thrift\Transport ' , 'fsockopen ' )
257+ ->expects ($ this ->once ())
258+ ->with (
259+ $ host ,
260+ $ port ,
261+ $ this ->anything (), #$errno,
262+ $ this ->anything (), #$errstr,
263+ $ this ->anything () #$this->sendTimeoutSec_ + ($this->sendTimeoutUsec_ / 1000000),
264+ );
265+
266+ $ transport = new TSocket (
267+ $ host ,
268+ $ port ,
269+ $ persist ,
270+ $ debugHandler
271+ );
272+
273+ $ transport ->open ();
274+ }
275+
249276 /**
250277 * @dataProvider open_THRIFT_5132_DataProvider
251278 */
You can’t perform that action at this time.
0 commit comments