com php-src: Fix buid with system libsqlite, see bug #74217: ext/pdo_sqlite/pdo_sqlite.c ext/pdo_sqlite/tests/pdo _sqlite_createfunction_with_flags.phpt ext/sqlite 3/sqlite3.c ext/sqlite3/tests/sqlite3_37_cr eatefunction_flags.phpt

[email protected] (Joe Watkins)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    a99cddf1c6cf1b60dd830edbe322b7b692bfd758
Author:    Remi Collet <[email protected]>         Wed, 29 Mar 2017 07:25:01 +0200
Committer: Joe Watkins <[email protected]>      Wed, 29 Mar 2017 07:54:44 +0100
Parents:   99d2cd0a324e6592be4b68f6b007703c2c7402c1
Branches:  PHP-7.1.4

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=a99cddf1c6cf1b60dd830edbe322b7b692bfd758

Log:
Fix buid with system libsqlite, see bug #74217

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...)

Bugs:
https://bugs.php.net/74217

Changed paths:
  M  ext/pdo_sqlite/pdo_sqlite.c
  M  ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
  M  ext/sqlite3/sqlite3.c
  M  ext/sqlite3/tests/sqlite3_37_createfunction_flags.phpt


Diff:
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index 621123b..d0eb182 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.c
@@ -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);
 }
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
index 4f0b675..d826d93 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
@@ -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
 
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 5a796e1..f1ed93b 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -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;
 }
diff --git a/ext/sqlite3/tests/sqlite3_37_createfunction_flags.phpt b/ext/sqlite3/tests/sqlite3_37_createfunction_flags.phpt
index 31fd42b..f9f0b5f 100644
--- a/ext/sqlite3/tests/sqlite3_37_createfunction_flags.phpt
+++ b/ext/sqlite3/tests/sqlite3_37_createfunction_flags.phpt
@@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.