Skip to content

Commit

Permalink
bug #442 Fix the ini_parse_quantity() polyfill (TimWolla)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Fix the `ini_parse_quantity()` polyfill

It previously was only defined (and tested) of the odbc extension is available.

Commits
-------

2183daf Fix the `ini_parse_quantity()` polyfill
  • Loading branch information
nicolas-grekas committed Sep 19, 2023
2 parents 5e9d505 + 2183daf commit 8b8e016
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
26 changes: 12 additions & 14 deletions src/Php82/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,18 @@
return;
}

if (!extension_loaded('odbc')) {
return;
}

if (!function_exists('odbc_connection_string_is_quoted')) {
function odbc_connection_string_is_quoted(string $str): bool { return p\Php82::odbc_connection_string_is_quoted($str); }
}

if (!function_exists('odbc_connection_string_should_quote')) {
function odbc_connection_string_should_quote(string $str): bool { return p\Php82::odbc_connection_string_should_quote($str); }
}

if (!function_exists('odbc_connection_string_quote')) {
function odbc_connection_string_quote(string $str): string { return p\Php82::odbc_connection_string_quote($str); }
if (extension_loaded('odbc')) {
if (!function_exists('odbc_connection_string_is_quoted')) {
function odbc_connection_string_is_quoted(string $str): bool { return p\Php82::odbc_connection_string_is_quoted($str); }
}

if (!function_exists('odbc_connection_string_should_quote')) {
function odbc_connection_string_should_quote(string $str): bool { return p\Php82::odbc_connection_string_should_quote($str); }
}

if (!function_exists('odbc_connection_string_quote')) {
function odbc_connection_string_quote(string $str): string { return p\Php82::odbc_connection_string_quote($str); }
}
}

if (!function_exists('ini_parse_quantity')) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Php82/Php82Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@

use PHPUnit\Framework\TestCase;

/**
* @requires extension odbc
*/
class Php82Test extends TestCase
{
/**
* @dataProvider provideConnectionStringValuesFromUpstream
* @dataProvider provideMoreConnectionStringValues
* @requires extension odbc
*/
public function testConnectionStringIsQuoted(string $value, bool $isQuoted)
{
Expand All @@ -30,6 +28,7 @@ public function testConnectionStringIsQuoted(string $value, bool $isQuoted)
/**
* @dataProvider provideConnectionStringValuesFromUpstream
* @dataProvider provideMoreConnectionStringValues
* @requires extension odbc
*/
public function testConnectionStringShouldQuote(string $value, bool $isQuoted, bool $shouldQuote)
{
Expand All @@ -39,6 +38,7 @@ public function testConnectionStringShouldQuote(string $value, bool $isQuoted, b
/**
* @dataProvider provideConnectionStringValuesFromUpstream
* @dataProvider provideMoreConnectionStringValues
* @requires extension odbc
*/
public function testConnectionStringQuote(string $value, bool $isQuoted, bool $shouldQuote, string $quoted)
{
Expand Down

0 comments on commit 8b8e016

Please sign in to comment.