File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -838,27 +838,29 @@ PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset
838
838
839
839
for (;escapestr < end ; escapestr ++ ) {
840
840
char esc = '\0' ;
841
- unsigned int len = 0 ;
842
841
843
842
/* check unicode characters
844
843
* Encodings that have a minimum length of 1 are compatible with ASCII.
845
844
* So we can skip (for performance reasons) the check to mb_valid for them. */
846
- if (cset -> char_maxlen > 1 && (* ((zend_uchar * ) escapestr ) > 0x80 || cset -> char_minlen > 1 ) && (len = cset -> mb_valid (escapestr , end ))) {
847
- /* check possible overflow */
848
- if ((newstr + len ) > newstr_e ) {
849
- escape_overflow = TRUE;
850
- break ;
851
- }
852
- /* copy mb char without escaping it */
853
- while (len -- ) {
854
- * newstr ++ = * escapestr ++ ;
845
+ if (cset -> char_maxlen > 1 && (* ((zend_uchar * ) escapestr ) > 0x80 || cset -> char_minlen > 1 )) {
846
+ unsigned int len = cset -> mb_valid (escapestr , end );
847
+ if (len ) {
848
+ /* check possible overflow */
849
+ if ((newstr + len ) > newstr_e ) {
850
+ escape_overflow = TRUE;
851
+ break ;
852
+ }
853
+ /* copy mb char without escaping it */
854
+ while (len -- ) {
855
+ * newstr ++ = * escapestr ++ ;
856
+ }
857
+ escapestr -- ;
858
+ continue ;
859
+ } else if (cset -> mb_charlen (* escapestr ) > 1 ) {
860
+ esc = * escapestr ;
855
861
}
856
- escapestr -- ;
857
- continue ;
858
862
}
859
- if (cset -> char_maxlen > 1 && cset -> mb_charlen (* escapestr ) > 1 ) {
860
- esc = * escapestr ;
861
- } else {
863
+ if (!esc ) {
862
864
switch (* escapestr ) {
863
865
case 0 :
864
866
esc = '0' ;
You can’t perform that action at this time.
0 commit comments