-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix segmentation fault in setOauthbearerTokenRefreshCb when sasl.oaut…
…hbearer.config is unset (#568) Only call ZVAL_STRING for &args[1] with oauthbearer_config if oauthbearer_config is set in kafka_conf_set_oauthbearer_token_refresh_cb Fixes #567
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--TEST-- | ||
Bug #567 | ||
--SKIPIF-- | ||
<?php | ||
RD_KAFKA_VERSION >= 0x01010000 || die("skip librdkafka too old does not support oauthbearer"); | ||
--FILE-- | ||
<?php | ||
|
||
$conf = new RdKafka\Conf(); | ||
if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) { | ||
$conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION')); | ||
} | ||
|
||
$conf->set('metadata.broker.list', 'foobar'); | ||
$conf->set('security.protocol', 'SASL_PLAINTEXT'); | ||
$conf->set('sasl.mechanisms', 'OAUTHBEARER'); | ||
$conf->setOauthbearerTokenRefreshCb(function ($producer) { | ||
echo "oauthbearer token refresh callback successfully called\n"; | ||
}); | ||
$producer = new \RdKafka\Producer($conf); | ||
$producer->poll(0); | ||
echo "producer polled successfully\n"; | ||
|
||
--EXPECT-- | ||
oauthbearer token refresh callback successfully called | ||
producer polled successfully |