Hi Matteo,

> -----Original Message-----
> From: Matteo Beccati [mailto:p...@beccati.com]
> Sent: Sunday, July 10, 2016 2:49 PM
> To: Anatol Belski <a...@php.net>
> Subject: Fwd: [PHP-CVS] com php-src: Fixed bug #72570 Segmentation fault
> when binding parameters on a query without placeholders: NEWS
> ext/pdo_pgsql/pgsql_statement.c ext/pdo_pgsql/tests/bug72570.phpt
> 
> Hi Anatol,
> 
> please consider this one for 7.0.9-rc2. It fixes a segmentation fault 
> introduced in
> 7.0.8.
> 
> The test might also depend on the other related fix for #70313.
> 
So you effectively suggest to take both #72570 and #70313 into the 7.0.9 final? 
I was thinking about merging #72570 partially, excluding test, do you think it 
would suffice?

Thanks

Anatol

> 
> Cheers
> 
> -------- Messaggio Inoltrato --------
> Oggetto: [PHP-CVS] com php-src: Fixed bug #72570 Segmentation fault when
> binding parameters on a query without placeholders: NEWS
> ext/pdo_pgsql/pgsql_statement.c ext/pdo_pgsql/tests/bug72570.phpt
> Data: Sun, 10 Jul 2016 12:36:07 +0000
> Mittente: Matteo Beccati <mbecc...@php.net>
> A: php-...@lists.php.net
> 
> Commit:    4d677ae0e2465188f59ec9226ee16011692286c8
> Author:    Matteo Beccati <mbecc...@php.net>         Sun, 10 Jul 2016
> 14:36:07 +0200
> Parents:   11d74b5b7977394f4dd02a8d6af34de10722beda
> Branches:  PHP-7.0 master
> 
> Link:
> http://git.php.net/?p=php-
> src.git;a=commitdiff;h=4d677ae0e2465188f59ec9226ee16011692286c8
> 
> Log:
> Fixed bug #72570 Segmentation fault when binding parameters on a query
> without placeholders
> 
> Bugs:
> https://bugs.php.net/72570
> 
> Changed paths:
>   M  NEWS
>   M  ext/pdo_pgsql/pgsql_statement.c
>   A  ext/pdo_pgsql/tests/bug72570.phpt
> 
> 
> Diff:
> diff --git a/NEWS b/NEWS
> index 91b1b64..9af6d5a 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -13,6 +13,8 @@ PHP
>                     NEWS
>   - PDO_pgsql:
>    . Fixed bug #70313 (PDO statement fails to throw exception). (Matteo)
> +  . Fixed bug #72570 (Segmentation fault when binding parameters on a query
> +    without placeholders). (Matteo)
>   - SPL:
>    . Fixed bug #55701 (GlobIterator throws LogicException). (Valentin
> VĂLCIU)
> diff --git a/ext/pdo_pgsql/pgsql_statement.c
> b/ext/pdo_pgsql/pgsql_statement.c index 517a597..a5ee2e9 100644
> --- a/ext/pdo_pgsql/pgsql_statement.c
> +++ b/ext/pdo_pgsql/pgsql_statement.c
> @@ -292,6 +292,9 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt,
> struct pdo_bound_param_data *
>                               break;
>                       case PDO_PARAM_EVT_ALLOC:
> +                             if (!stmt->bound_param_map) {
> +                                     return 1;
> +                             }
>                               if (!zend_hash_index_exists(stmt-
> >bound_param_map, param->paramno)) {
>                                       pdo_raise_impl_error(stmt->dbh, stmt,
> "HY093", "parameter was not defined");
>                                       return 0;
> diff --git a/ext/pdo_pgsql/tests/bug72570.phpt
> b/ext/pdo_pgsql/tests/bug72570.phpt
> new file mode 100644
> index 0000000..1ac68a3
> --- /dev/null
> +++ b/ext/pdo_pgsql/tests/bug72570.phpt
> @@ -0,0 +1,28 @@
> +--TEST--
> +PDO PgSQL Bug #72570 (Segmentation fault when binding parameters on a
> query without placeholders)
> +--SKIPIF--
> +<?php
> +if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql'))
> die('skip not loaded');
> +require dirname(__FILE__) . '/config.inc'; require dirname(__FILE__) .
> +'/../../../ext/pdo/tests/pdo_test.inc';
> +PDOTest::skip();
> +?>
> +--FILE--
> +<?php
> +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
> +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
> +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
> +
> +$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
> +
> +$stmt = $db->prepare("SELECT 1");
> +
> +try {
> +     $stmt->execute([1]);
> +} catch (PDOException $e) {
> +     var_dump($e->getCode());
> +}
> +
> +?>
> +--EXPECT--
> +string(5) "08P01"
> 
> 
> --
> PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to