Doc #70326 [NEW]: Incorrect and incomplete list of log callbacks

From: Date: Sat, 22 Aug 2015 14:05:16 +0000
Subject: Doc #70326 [NEW]: Incorrect and incomplete list of log callbacks
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12632@lists.php.net to get a copy of this message
From: fgm at osinet dot fr Operating system: Linux PHP version: 5.6.12 Package: mongo Bug Type: Documentation Problem Bug description:Incorrect and incomplete list of log callbacks Description: ------------ The MongoDB Context Options doc page at http://php.net/manual/en/context.mongodb.php omits two such working callbacks: - log_query, needed to log commands including $query - log_batchinsert, fto log batch inserts. And it mentions log_write_batch, which does not seem to exist, maybe an old name for log_batchinsert. By the docs, the sample script should call log_write_batch and not the other 2 loggers, but it calls them and not log_write_batch. See PHP test file tests/mongos/stream-logger-001.phpt Test script: --------------- <?php function log_batchinsert (array $server, array $docs, array $info, array $options) { echo "Batch Insert " . count($docs) . " documents.\n"; } function log_write_batch () { echo __METHOD__ . "\n"; } function log_query(array $server, array $criteria, array $queryOptions) { echo "Query: " . json_encode($criteria) . "\n"; } $context = stream_context_create([ 'mongodb' => ['log_batchinsert' => 'log_batchinsert', 'log_write_batch' => 'log_write_batch', 'log_query' => 'log_query'], ]); $server = 'mongodb://localhost:27017'; $client = new \MongoClient($server, [], ['context' => $context]); $collection = $client->selectDB('bug')->selectCollection('bug_collection'); $collection->drop(); $docs = [['foo' => 'bar'], ['baz' => 'quux']]; $result = $collection->batchInsert($docs); Expected result: ---------------- log_write_batch Actual result: -------------- Query: {"drop":"bug_collection"} Batch Insert 2 documents. Query: {"getlasterror":1} -- Edit bug report at https://bugs.php.net/bug.php?id=70326&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70326&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70326&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70326&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70326&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70326&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70326&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70326&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70326&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70326&r=support Expected behavior: https://bugs.php.net/fix.php?id=70326&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70326&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70326&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70326&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70326&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70326&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70326&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70326&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70326&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70326&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70326&r=mysqlcfg

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