1--TEST-- 2Pdo\Sqlite load extension 3--EXTENSIONS-- 4pdo_sqlite 5--SKIPIF-- 6<?php 7if (!method_exists(Pdo\Sqlite::class, "loadExtension")) { 8 die("skip loading sqlite extensions is not supported"); 9} 10?> 11--FILE-- 12<?php 13 14$db = Pdo\Sqlite::connect('sqlite::memory:'); 15if (!$db instanceof Pdo\Sqlite) { 16 echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($db) . "\n"; 17} 18 19try { 20 echo "Loading non-existent file.\n"; 21 $result = $db->loadExtension("/this/does/not_exist"); 22 echo "Failed to throw exception"; 23} 24catch (PDOException $pdoException) { 25 echo $pdoException->getMessage() . "\n"; 26} 27 28try { 29 echo "Loading invalid file.\n"; 30 $result = $db->loadExtension(__FILE__); 31 echo "Failed to throw exception"; 32} 33catch (PDOException $pdoException) { 34 echo $pdoException->getMessage() . "\n"; 35} 36 37echo "Fin."; 38?> 39--EXPECTF-- 40Loading non-existent file. 41Unable to load extension "/this/does/not_exist" 42Loading invalid file. 43Unable to load extension "%a" 44Fin. 45