Skip to content

Commit dbfcee0

Browse files
committed
try to improve support for 8.7
1 parent 439b280 commit dbfcee0

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to `:vips` will be documented in this file.
1010
- added streaming examples [jcupitt]
1111
- fix php 8.3 compatibility [uuf6429]
1212
- better library finding [uuf6429]
13+
- fix compat with libvips before 8.9 [allanvb]
1314

1415
## 2.3.0 - 2023-09-26
1516

src/FFI.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -812,14 +812,19 @@ private static function init(): void
812812
"VipsOperation" => self::$vips->type("VipsOperation*"),
813813
"VipsImage" => self::$vips->type("VipsImage*"),
814814
"VipsInterpolate" => self::$vips->type("VipsInterpolate*"),
815-
"VipsConnection" => self::$vips->type("VipsConnection*"),
816-
"VipsSource" => self::$vips->type("VipsSource*"),
817-
"VipsSourceCustom" => self::$vips->type("VipsSourceCustom*"),
818-
"VipsTarget" => self::$vips->type("VipsTarget*"),
819-
"VipsTargetCustom" => self::$vips->type("VipsTargetCustom*"),
820815
"VipsProgress" => self::$vips->type("VipsProgress*"),
821816
];
822817

818+
if (self::atLeast(8, 9)) {
819+
self::$ctypes = array_merge(self::$ctypes, [
820+
"VipsConnection" => self::$vips->type("VipsConnection*"),
821+
"VipsSource" => self::$vips->type("VipsSource*"),
822+
"VipsSourceCustom" => self::$vips->type("VipsSourceCustom*"),
823+
"VipsTarget" => self::$vips->type("VipsTarget*"),
824+
"VipsTargetCustom" => self::$vips->type("VipsTargetCustom*"),
825+
]);
826+
}
827+
823828
self::$gtypes = [
824829
"gboolean" => self::$gobject->g_type_from_name("gboolean"),
825830
"gint" => self::$gobject->g_type_from_name("gint"),

tests/StreamingTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Jcupitt\Vips\Test;
44

55
use Generator;
6+
use Jcupitt\Vips\FFI;
67
use Jcupitt\Vips\Exception;
78
use Jcupitt\Vips\Image;
89
use Jcupitt\Vips\Source;
@@ -13,6 +14,15 @@
1314

1415
class StreamingTest extends TestCase
1516
{
17+
protected function setUp(): void
18+
{
19+
parent::setUp();
20+
21+
if (!FFI::atLeast(8, 9)) {
22+
$this->markTestSkipped('libvips too old for streaming tests');
23+
}
24+
}
25+
1626
/**
1727
* @throws Exception
1828
*/

0 commit comments

Comments
 (0)