Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
aafe60e6
Commit
aafe60e6
authored
Sep 25, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DBAL-164' into 2.1.x
parents
03ea4779
03526de9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
OCI8Connection.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
+6
-2
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+8
-0
No files found.
lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
View file @
aafe60e6
...
@@ -81,9 +81,13 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
...
@@ -81,9 +81,13 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
* @param int $type PDO::PARAM*
* @param int $type PDO::PARAM*
* @return mixed
* @return mixed
*/
*/
public
function
quote
(
$
input
,
$type
=
\PDO
::
PARAM_STR
)
public
function
quote
(
$
value
,
$type
=
\PDO
::
PARAM_STR
)
{
{
return
is_numeric
(
$input
)
?
$input
:
"'
$input
'"
;
if
(
is_int
(
$value
)
||
is_float
(
$value
))
{
return
$value
;
}
$value
=
str_replace
(
"'"
,
"''"
,
$value
);
return
"'"
.
addcslashes
(
$value
,
"
\000\n\r\\\032
"
)
.
"'"
;
}
}
/**
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
aafe60e6
...
@@ -269,4 +269,12 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -269,4 +269,12 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertEquals
(
'2010-03-01'
,
date
(
'Y-m-d'
,
strtotime
(
$row
[
'add_month'
])),
"Adding month should end up on 2010-03-01"
);
$this
->
assertEquals
(
'2010-03-01'
,
date
(
'Y-m-d'
,
strtotime
(
$row
[
'add_month'
])),
"Adding month should end up on 2010-03-01"
);
$this
->
assertEquals
(
'2009-11-01'
,
date
(
'Y-m-d'
,
strtotime
(
$row
[
'sub_month'
])),
"Adding month should end up on 2009-11-01"
);
$this
->
assertEquals
(
'2009-11-01'
,
date
(
'Y-m-d'
,
strtotime
(
$row
[
'sub_month'
])),
"Adding month should end up on 2009-11-01"
);
}
}
public
function
testQuoteSQLInjection
()
{
$sql
=
"SELECT * FROM fetch_table WHERE test_string = "
.
$this
->
_conn
->
quote
(
"bar' OR '1'='1"
);
$rows
=
$this
->
_conn
->
fetchAll
(
$sql
);
$this
->
assertEquals
(
0
,
count
(
$rows
),
"no result should be returned, otherwise SQL injection is possible"
);
}
}
}
\ No newline at end of file
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