Doc #63050 [Opn->Csd]: Change in behaviour for return value of unsafe writes

From: Date: Thu, 29 Nov 2012 11:38:23 +0000
Subject: Doc #63050 [Opn->Csd]: Change in behaviour for return value of unsafe writes
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9223@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63050&edit=1 ID: 63050 Updated by: derick@php.net Reported by: adam at hipsnip dot com Summary: Change in behaviour for return value of unsafe writes -Status: Open +Status: Closed Type: Documentation Problem Package: mongo PHP Version: Irrelevant -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: This seems to be not the case in the 1.3.0 final release. It successfully reports bool(true) for me: <?php $m = new MongoClient(); $c = $m->selectDb(dbname())->bug605; $c->remove(); var_dump( $c->insert( array( 'test' => 'one' ) ) ); var_dump( $c->insert( array( 'test' => 'two' ), array( 'w' => 0 ) ) ); var_dump( $c->insert( array( 'test' => 'two' ), array( 'w' => 1 ) ) ); ?> returns (as expected): array(4) { ["n"]=> int(0) ["connectionId"]=> int(89) ["err"]=> NULL ["ok"]=> float(1) } bool(true) array(4) { ["n"]=> int(0) ["connectionId"]=> int(89) ["err"]=> NULL ["ok"]=> float(1) } Previous Comments: ------------------------------------------------------------------------ [2012-09-10 00:11:38] adam at hipsnip dot com Description: ------------ --- From manual page: http://www.php.net/mongo.writes --- In version 1.2.x of the driver, when performing a write operation with the "safe => false" (unsafe) flag set, it would return a boolean value. In 1.3.0 (beta2) it appears that this is no longer the case, as these operations have no return value (null). While this makes sense - since we won't really know if the operation succeeded - this will break applications which expect that boolean return value. Therefore this change in behaviour should be noted on the documentation page for mongo write operations. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63050&edit=1

« previous php.doc.bugs (#9223) next »