<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu" -->

---
title: [PR #22159] ext/curl: expose...
description: A pull request (PR #22159) proposes adding three libcurl socket callback options to PHP&#x27;s ext/curl extension for PHP 8.6: CURLOPT_SOCKOPTFUNCTION,...
canonical: https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: [PR #22159] ext/curl: expose SOCKOPT/OPENSOCKET/CLOSESOCKET callbacks | daily.dev
og:description: A pull request (PR #22159) proposes adding three libcurl socket callback options to PHP&#x27;s ext/curl extension for PHP 8.6: CURLOPT_SOCKOPTFUNCTION,...
og:url: https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu
og:image: https://api.daily.dev/og/posts/waaKuY8yu.png
og:image:alt: [PR #22159] ext/curl: expose SOCKOPT/OPENSOCKET/CLOSESOCKET callbacks
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# [PR #22159] ext/curl: expose SOCKOPT/OPENSOCKET/CLOSESOCKET callbacks

**[externals.io](https://daily.dev/sources/externals)** · 1 min read · 0 upvotes · 0 comments

## Summary

A pull request (PR #22159) proposes adding three libcurl socket callback options to PHP's ext/curl extension for PHP 8.6: CURLOPT_SOCKOPTFUNCTION, CURLOPT_OPENSOCKETFUNCTION, and CURLOPT_CLOSESOCKET FUNCTION. The motivation is to give PHP developers a native way to perform SSRF filtering (validating resolved peer IPs before connecting) and low-level socket tuning (SO_BINDTODEVICE, SO_MARK, keepalive, TCP_NODELAY) without resorting to ext/ffi. The callbacks bridge to ext/sockets, exposing real Socket objects usable with standard socket functions. CI passes on Linux, macOS, FreeBSD, Windows, and ASAN.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://externals.io/message/131275>

## Similar posts on daily.dev

- [\[PR \#22159\] ext/curl: expose SOCKOPT/OPENSOCKET/CLOSESOCKET callbacks](https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-erbjihry0) · externals.io · 0 upvotes · 0 comments
- [\[RFC idea\] DTLS support in ext/openssl \(Openssl\\Dtls\)](https://daily.dev/posts/rfc-idea-dtls-support-in-ext-openssl-openssl-dtls--9ergpkufa) · externals.io · 0 upvotes · 0 comments
- [\[RFC idea\] DTLS support in ext/openssl \(Openssl\\Dtls\)](https://daily.dev/posts/rfc-idea-dtls-support-in-ext-openssl-openssl-dtls--zl8jnqlfp) · externals.io · 0 upvotes · 0 comments
- [curl 8.22.0](https://daily.dev/posts/curl-8-22-0-ovkooqlqx) · daniel.haxx.se · 4 upvotes · 0 comments
- [\[RFC idea\] DTLS support in ext/openssl \(Openssl\\Dtls\)](https://daily.dev/posts/rfc-idea-dtls-support-in-ext-openssl-openssl-dtls--cuhmgnizh) · externals.io · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#php](https://daily.dev/tags/php), [#curl](https://daily.dev/tags/curl)

[View this post on daily.dev](https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"[PR #22159] ext/curl: expose SOCKOPT/OPENSOCKET/CLOSESOCKET callbacks","url":"https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu"},"datePublished":"2026-06-15T13:28:56.130Z","dateModified":"2026-06-15T13:30:36.968Z","description":"A pull request (PR #22159) proposes adding three libcurl socket callback options to PHP's ext/curl extension for PHP 8.6: CURLOPT_SOCKOPTFUNCTION,...","image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","thumbnailUrl":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","isAccessibleForFree":true,"articleSection":"externals.io","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"externals.io","logo":"https://media.daily.dev/image/upload/s--9i0zxASK--/f_auto,q_auto/v1780213616/logos/externals?_a=BAMAMiWQ0","url":"https://daily.dev/sources/externals"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/pr-22159-ext-curl-expose-sockopt-opensocket-closesocket-callbacks-waakuy8yu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,php,curl","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"externals.io","item":"https://daily.dev/sources/externals"},{"@type":"ListItem","position":3,"name":"[PR #22159] ext/curl: expose SOCKOPT/OPENSOCKET/CLOSESOCKET callbacks"}]}
```

