Skip to content

Commit 9ec30f5

Browse files
committed
added vips_error_buffer()
not clear if it'll leak though
1 parent 63d3c13 commit 9ec30f5

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ vips extension changelog
33
Version 0.1.1 (2016-10-03)
44
--------------------------
55
* Support draw operations
6+
* Add vips_error_buffer()
67

78
Version 0.1.0 (2016-09-20)
89
--------------------------

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ I used 7.0.11 and configured with:
5454
```
5555
$ ./configure --prefix=/home/john/vips --enable-debug --enable-maintainer-zts \
5656
--enable-cgi --enable-cli --with-readline --with-openssl --with-zlib \
57-
--with-gd --with-jpeg-dir=/usr
57+
--with-gd --with-jpeg-dir=/usr --with-libxml-dir=/usr
5858
```
5959

6060
You'll need libvips 8.0 or later, including all the headers for

vips.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ vips_php_call_array(const char *operation_name, zval *instance,
949949
}
950950
else if (call->argc != call->args_required) {
951951
php_error_docref(NULL, E_WARNING,
952-
"operation expects %d arguments, but you supplied %d",
953-
call->args_required, call->argc);
952+
"operation %s expects %d arguments, but you supplied %d",
953+
call->operation_name, call->args_required, call->argc);
954954
vips_object_unref_outputs(VIPS_OBJECT(call->operation));
955955
vips_php_call_free(call);
956956
return -1;
@@ -1423,6 +1423,19 @@ PHP_FUNCTION(vips_image_set)
14231423
}
14241424
/* }}} */
14251425

1426+
/* {{{ proto string vips_error_buffer()
1427+
Fetch and clear the vips error buffer */
1428+
PHP_FUNCTION(vips_error_buffer)
1429+
{
1430+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
1431+
return;
1432+
}
1433+
1434+
RETVAL_STRING(strdup(vips_error_buffer()));
1435+
vips_error_clear();
1436+
}
1437+
/* }}} */
1438+
14261439
/* {{{ php_vips_init_globals
14271440
*/
14281441
/* Uncomment this function if you have INI entries
@@ -1565,6 +1578,9 @@ ZEND_BEGIN_ARG_INFO(arginfo_vips_image_set, 0)
15651578
ZEND_ARG_INFO(0, value)
15661579
ZEND_END_ARG_INFO()
15671580

1581+
ZEND_BEGIN_ARG_INFO(arginfo_vips_error_buffer, 0)
1582+
ZEND_END_ARG_INFO()
1583+
15681584
/* {{{ vips_functions[]
15691585
*
15701586
* Every user visible function must have an entry in vips_functions[].
@@ -1579,6 +1595,7 @@ const zend_function_entry vips_functions[] = {
15791595
PHP_FE(vips_image_get, arginfo_vips_image_get)
15801596
PHP_FE(vips_image_get_typeof, arginfo_vips_image_get_typeof)
15811597
PHP_FE(vips_image_set, arginfo_vips_image_set)
1598+
PHP_FE(vips_error_buffer, arginfo_vips_error_buffer)
15821599

15831600
PHP_FE_END /* Must be the last line in vips_functions[] */
15841601
};

0 commit comments

Comments
 (0)