~ubuntu-branches/ubuntu/lucid/php5/lucid

« back to all changes in this revision

Viewing changes to ext/pdo/pdo.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-03-16 09:09:50 UTC
  • mfrom: (1.1.18 upstream) (0.3.10 sid)
  • Revision ID: james.westby@ubuntu.com-20100316090950-e36m0pzranoixifd
Tags: 5.3.2-1ubuntu1
* Merge from debian unstable: 
  - debian/control:
    * Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
    * Dropped libmysqlclient15-dev, build against mysql 5.1.
    * Dropped libcurl-dev not in the archive.
    * Suggest php5-suhosin rather than recommends.
    * Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions already in
      universe.
    * Dropped libonig-dev and libqgdbm since its in universe. (will be re-added in lucid+1)
    * Dropped locales-all.
  - modulelist: Drop imap, interbase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
  - Dropped debian/patches/libedit_is_editline.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
  +----------------------------------------------------------------------+
3
3
  | PHP Version 5                                                        |
4
4
  +----------------------------------------------------------------------+
5
 
  | Copyright (c) 1997-2009 The PHP Group                                |
 
5
  | Copyright (c) 1997-2010 The PHP Group                                |
6
6
  +----------------------------------------------------------------------+
7
7
  | This source file is subject to version 3.01 of the PHP license,      |
8
8
  | that is bundled with this package in the file LICENSE, and is        |
18
18
  +----------------------------------------------------------------------+
19
19
*/
20
20
 
21
 
/* $Id: pdo.c 284394 2009-07-19 22:46:03Z felipe $ */
 
21
/* $Id: pdo.c 293036 2010-01-03 09:23:27Z sebastian $ */
22
22
 
23
23
#ifdef HAVE_CONFIG_H
24
24
#include "config.h"
222
222
        int optstart = 0;
223
223
        int nlen;
224
224
        int n_matches = 0;
 
225
        int n_semicolumns = 0;
225
226
 
226
227
        i = 0;
227
228
        while (i < data_source_len) {
240
241
 
241
242
                /* now we're looking for VALUE; or just VALUE<NUL> */
242
243
                semi = -1;
 
244
                n_semicolumns = 0;
243
245
                while (i < data_source_len) {
244
246
                        if (data_source[i] == '\0') {
245
247
                                semi = i++;
246
248
                                break;
247
249
                        }
248
250
                        if (data_source[i] == ';') {
249
 
                                semi = i++;
250
 
                                break;
 
251
                                if ((i + 1 >= data_source_len) || data_source[i+1] != ';') {
 
252
                                        semi = i++;
 
253
                                        break;
 
254
                                } else {
 
255
                                        n_semicolumns++; 
 
256
                                        i += 2;
 
257
                                        continue;
 
258
                                }
251
259
                        }
252
260
                        ++i;
253
261
                }
264
272
                                if (parsed[j].freeme) {
265
273
                                        efree(parsed[j].optval);
266
274
                                }
267
 
                                parsed[j].optval = estrndup(data_source + valstart, semi - valstart);
 
275
 
 
276
                                if (n_semicolumns == 0) {
 
277
                                        parsed[j].optval = estrndup(data_source + valstart, semi - valstart - n_semicolumns);
 
278
                                } else {
 
279
                                        int vlen = semi - valstart;
 
280
                                        char *orig_val = data_source + valstart;
 
281
                                        char *new_val  = (char *) emalloc(vlen - n_semicolumns + 1);
 
282
                                
 
283
                                        parsed[j].optval = new_val;
 
284
 
 
285
                                        while (vlen && *orig_val) {
 
286
                                                *new_val = *orig_val;
 
287
                                                new_val++;
 
288
 
 
289
                                                if (*orig_val == ';') {
 
290
                                                        orig_val+=2; 
 
291
                                                        vlen-=2;
 
292
                                                } else {
 
293
                                                        orig_val++;
 
294
                                                        vlen--;
 
295
                                                }
 
296
                                        }
 
297
                                        *new_val = '\0';
 
298
                                }
 
299
 
268
300
                                parsed[j].freeme = 1;
269
301
                                ++n_matches;
270
302
                                break;