| 1 | Fix build against PHP 8.6: php_error_docref1() was removed
|
| 2 |
|
| 3 | PHP 8.6 removed php_error_docref1() (php-src UPGRADING.INTERNALS,
|
| 4 | "Removed" section); the docref parameter is no longer supported.
|
| 5 |
|
| 6 | The two call sites passed the SMB URL as that parameter, so route them
|
| 7 | through a SMBCLIENT_ERROR_URL() helper that folds the URL into the
|
| 8 | message on 8.6+ and keeps php_error_docref1() on older versions.
|
| 9 |
|
| 10 | Not fixed upstream: eduardok/libsmbclient-php master still calls
|
| 11 | php_error_docref1() as of 2026-07-30.
|
| 12 |
|
| 13 | |
| 14 | |
| 15 | @@ -129,6 +129,17 @@
|
| 16 | #define TSRMLS_FETCH()
|
| 17 | #endif
|
| 18 |
|
| 19 | +/* php_error_docref1() was removed in PHP 8.6. It printed the URL as the
|
| 20 | + * docref parameter, so fold it into the message to keep reporting which
|
| 21 | + * path failed. */
|
| 22 | +#if PHP_VERSION_ID >= 80600
|
| 23 | +#define SMBCLIENT_ERROR_URL(url, type, fmt, ...) \
|
| 24 | + php_error_docref(NULL, type, "%s: " fmt, url, __VA_ARGS__)
|
| 25 | +#else
|
| 26 | +#define SMBCLIENT_ERROR_URL(url, type, fmt, ...) \
|
| 27 | + php_error_docref1(NULL, url, type, fmt, __VA_ARGS__)
|
| 28 | +#endif
|
| 29 | +
|
| 30 | extern php_stream_wrapper php_stream_smb_wrapper;
|
| 31 | php_smbclient_state * php_smbclient_state_new (php_stream_context *context, int init TSRMLS_DC);
|
| 32 | void php_smbclient_state_free (php_smbclient_state *state TSRMLS_DC);
|
| 33 | |
| 34 | |
| 35 | @@ -688,12 +688,12 @@
|
| 36 | break;
|
| 37 |
|
| 38 | default:
|
| 39 | - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Unknown option %d for stream_metadata", option);
|
| 40 | + SMBCLIENT_ERROR_URL(url, E_WARNING, "Unknown option %d for stream_metadata", option);
|
| 41 | return 0;
|
| 42 | }
|
| 43 | php_smb_pool_drop(state TSRMLS_CC);
|
| 44 | if (ret == -1) {
|
| 45 | - php_error_docref1(NULL TSRMLS_CC, url, E_WARNING, "Operation failed: %s", strerror(errno));
|
| 46 | + SMBCLIENT_ERROR_URL(url, E_WARNING, "Operation failed: %s", strerror(errno));
|
| 47 | return 0;
|
| 48 | }
|
| 49 | php_clear_stat_cache(0, NULL, 0 TSRMLS_CC);
|