Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
c4155c52
Commit
c4155c52
authored
Jun 26, 2018
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #545
parents
f3fb0d4c
ffcccf3c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
BSONIterator.php
src/Model/BSONIterator.php
+5
-5
No files found.
src/Model/BSONIterator.php
View file @
c4155c52
...
...
@@ -26,6 +26,8 @@ use Iterator;
*/
class
BSONIterator
implements
Iterator
{
private
static
$bsonSize
=
4
;
private
$buffer
;
private
$bufferLength
;
private
$current
;
...
...
@@ -33,8 +35,6 @@ class BSONIterator implements Iterator
private
$position
=
0
;
private
$options
;
const
BSON_SIZE
=
4
;
/**
* Constructs a BSON Iterator.
*
...
...
@@ -119,11 +119,11 @@ class BSONIterator implements Iterator
return
;
}
if
((
$this
->
bufferLength
-
$this
->
position
)
<
self
::
BSON_SIZE
)
{
throw
new
UnexpectedValueException
(
sprintf
(
'Expected at least %d bytes; %d remaining'
,
self
::
BSON_SIZE
,
$this
->
bufferLength
-
$this
->
position
));
if
((
$this
->
bufferLength
-
$this
->
position
)
<
self
::
$bsonSize
)
{
throw
new
UnexpectedValueException
(
sprintf
(
'Expected at least %d bytes; %d remaining'
,
self
::
$bsonSize
,
$this
->
bufferLength
-
$this
->
position
));
}
list
(,
$documentLength
)
=
unpack
(
'V'
,
substr
(
$this
->
buffer
,
$this
->
position
,
self
::
BSON_SIZE
));
list
(,
$documentLength
)
=
unpack
(
'V'
,
substr
(
$this
->
buffer
,
$this
->
position
,
self
::
$bsonSize
));
if
((
$this
->
bufferLength
-
$this
->
position
)
<
$documentLength
)
{
throw
new
UnexpectedValueException
(
sprintf
(
'Expected %d bytes; %d remaining'
,
$documentLength
,
$this
->
bufferLength
-
$this
->
position
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment