]> granicus.if.org Git - php/commitdiff
Fix buid with system libsqlite, see bug #74217
authorRemi Collet <remi@php.net>
Wed, 29 Mar 2017 05:25:01 +0000 (07:25 +0200)
committerRemi Collet <remi@php.net>
Wed, 29 Mar 2017 05:25:01 +0000 (07:25 +0200)
SQLITE_DETERMINISTIC only exists in recent version
e.g. missing on 3.7 which is the default on RHEL/CentOS-7
and probably others (wheezy have 3.7, jessie 3.8...)

ext/pdo_sqlite/pdo_sqlite.c
ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
ext/sqlite3/sqlite3.c
ext/sqlite3/tests/sqlite3_37_createfunction_flags.phpt

index 621123b39ab6608dc4947d8906e465ffd575ce9f..d0eb1823d61db8b15b475c1f829f23473d8b2882 100644 (file)
@@ -69,7 +69,9 @@ ZEND_GET_MODULE(pdo_sqlite)
 /* {{{ PHP_MINIT_FUNCTION */
 PHP_MINIT_FUNCTION(pdo_sqlite)
 {
+#ifdef SQLITE_DETERMINISTIC
        REGISTER_PDO_CLASS_CONST_LONG("SQLITE_DETERMINISTIC", (zend_long)SQLITE_DETERMINISTIC);
+#endif
 
        return php_pdo_register_driver(&pdo_sqlite_driver);
 }
index 4f0b6754a178614912d425329d037234378ecb56..d826d93ddfa3d1bbad0304852312d66172fd49b4 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 PDO_sqlite: Testing sqliteCreateFunction() with flags
 --SKIPIF--
-<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
+<?php
+if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
+if (!defined('PDO::SQLITE_DETERMINISTIC')) die('skip system sqlite is to old');
+?>
 --FILE--
 <?php
 
index 5a796e1bbf67c9fb217f856c7b15024c29306272..f1ed93b06f9c73be0da1b57f5faa29de3a38677a 100644 (file)
@@ -2283,7 +2283,9 @@ PHP_MINIT_FUNCTION(sqlite3)
        REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT);
 
+#ifdef SQLITE_DETERMINISTIC
        REGISTER_LONG_CONSTANT("SQLITE3_DETERMINISTIC", SQLITE_DETERMINISTIC, CONST_CS | CONST_PERSISTENT);
+#endif
 
        return SUCCESS;
 }
index 31fd42bc760b51b39ae802723de1d2bb07a0517c..f9f0b5f33a79a3a4e35fb99b644cd7f42c9eb7f9 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 SQLite3::createFunction - Test with flags
 --SKIPIF--
-<?php require_once(__DIR__ . '/skipif.inc'); ?>
+<?php
+require_once(__DIR__ . '/skipif.inc');
+if (!defined('SQLITE3_DETERMINISTIC')) die('skip system sqlite is to old');
+?>
 --FILE--
 <?php