Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
Z
zendframework1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
common
zendframework1
Commits
9e99dceb
Commit
9e99dceb
authored
Nov 05, 2018
by
David Weston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed fix
parent
e7799144
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
src/Zend/Db/Statement.php
src/Zend/Db/Statement.php
+6
-9
No files found.
src/Zend/Db/Statement.php
View file @
9e99dceb
...
...
@@ -175,25 +175,23 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
// get the character for value quoting
// this should be '
$q
=
$this
->
_adapter
->
quote
(
'a'
);
$q
=
$q
[
0
];
$q
=
$q
[
0
];
// get the value used as an escaped quote,
// e.g. \' or ''
$qe
=
$this
->
_adapter
->
quote
(
$q
);
$qe
=
substr
(
$qe
,
1
,
2
);
$qe
=
preg_quote
(
$qe
);
$escapeChar
=
substr
(
$qe
,
0
,
1
);
// remove 'foo\'bar'
if
(
!
empty
(
$q
))
{
$escapeChar
=
preg_quote
(
$escapeChar
);
// this segfaults only after 65,000 characters instead of 9,000
$sql
=
preg_replace
(
"/
$q
([^
$q
{
$escapeChar
}
]*|(
$qe
)*)*
$q
/s"
,
''
,
$sql
);
$sql
=
preg_replace
(
"/
$q
(
$qe
+|
\\\\
{
2
}
+|[^
$q
]+|(?<=
\\\\
)
$q
)*
$q
/"
,
''
,
$sql
);
# i3MEDIA fix for DB speed issues
}
// get a version of the SQL statement with all quoted
// values and delimited identifiers stripped out
// remove "foo\"bar"
$sql
=
preg_replace
(
'/"(\\\\"|[^"])*"/Us'
,
''
,
$sql
);
$sql
=
preg_replace
(
"/
\"
(
\\\\\"
|[^
\"
])*
\"
/Us"
,
''
,
$sql
);
// get the character for delimited id quotes,
// this is usually " but in MySQL is `
$d
=
$this
->
_adapter
->
quoteIdentifier
(
'a'
);
...
...
@@ -205,7 +203,6 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
$de
=
preg_quote
(
$de
);
// Note: $de and $d where never used..., now they are:
$sql
=
preg_replace
(
"/
$d
(
$de
|
\\\\
{
2
}
|[^
$d
])*
$d
/Us"
,
''
,
$sql
);
return
$sql
;
}
...
...
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