Điểm Tin Công NghệBản Tin TrưaMidday Bulletin
Bản tin 20/11Bulletin 20/11

Công nghệ & DevTech & Dev · 20/11 · Mã bàiArticle BT-274 · HOT

PHP 8.6 chính thức ra mắt: Partial Function Application, clamp(), Time\Duration — bản nâng cấp lớn của PHP trong nămPHP 8.6 is officially out: Partial Function Application, clamp(), Time\Duration — PHP's big upgrade of the year

Đăng bàiPostXem bài viết gốcView original article

Mẹo: Dùng Microsoft Edge để nghe giọng đọc tiếng Việt tự nhiên hơn (HoaiMy, NamMinh).Tip: Use Microsoft Edge for more natural Vietnamese read-aloud voices (HoaiMy, NamMinh).

Ảnh minh họa cho bài: PHP 8.6 chính thức ra mắt: Partial Function Application, clamp(), Time\Duration — bản nâng cấp lớn của PHP trong năm
Ảnh minh họa — code trên laptop (Unsplash)Illustrative image — code trên laptop (Unsplash)

Sau 7 bản release candidate, PHP 8.6 đã chính thức phát hành ngày 19/11 — và đây không phải bản vá thường kỳ. Tính năng đáng chú ý nhất là Partial Function Application, viết lại cách dev PHP viết callback; cùng với đó là kiểu Duration chuẩn để đo thời gian, một API polling mới cho lập trình bất đồng bộ, và hàm `clamp()` mà gần như dev nào cũng từng tự viết lại bằng `min(max(...))`.After 7 release candidates, PHP 8.6 officially shipped on November 19 — and this is no routine patch. The headline feature is Partial Function Application, which rewrites how PHP developers write callbacks; alongside it come a standard Duration type for measuring time, a new polling API for async programming, and a `clamp()` function almost every developer has hand-rolled with `min(max(...))`.

Sau 7 bản release candidate, PHP 8.6 đã chính thức phát hành ngày 19/11 — và đây không phải bản vá thường kỳ. Tính năng đáng chú ý nhất là Partial Function Application, viết lại cách dev PHP viết callback; cùng với đó là kiểu Duration chuẩn để đo thời gian, một API polling mới cho lập trình bất đồng bộ, và hàm clamp() mà gần như dev nào cũng từng tự viết lại bằng min(max(...)).

Thông số nổi bật

Tính năngNói ngắn gọn
Partial Function ApplicationGọi hàm với một phần tham số, dùng ? làm chỗ giữ, nhận về một Closure chờ phần còn lại
Time\DurationKiểu thời lượng chuẩn, chính xác tới nano giây, biểu diễn được hơn 250 năm — thay cho số micro giây rời rạc
Polling API (Io\Poll)Giám sát nhiều stream cùng lúc bằng epoll/kqueue/WSAPoll, nền tảng chung cho ReactPHP và AMPHP
clamp()Giữ một giá trị trong khoảng cho trước, dùng được với cả số lẫn Duration
SortDirection enumCách chuẩn, type-safe để biểu diễn thứ tự sắp xếp, thay cho SORT_ASC/SORT_DESC rời rạc
Readonly property defaultsThuộc tính readonly giờ khai báo được giá trị mặc định, không cần gán trong constructor
Xử lý lỗi stream mớiLỗi stream thành StreamException/StreamError có cấu trúc, thay cho cảnh báo rời rạc
#[\Override] cho hằngAttribute này giờ dùng được cho class constant và enum case
Sodium hậu lượng tửThêm X-Wing và ML-KEM-768, mã hóa địa chỉ IP, hàm SHAKE và TurboSHAKE

Điểm mới

Ngoài ra còn có Uri builders (Uri\Rfc3986\UriBuilder, Uri\WhatWg\UrlBuilder), DocComment riêng cho từng tham số hàm (đọc qua ReflectionParameter::getDocComment()), và thuộc tính của object trong hằng giờ sửa trực tiếp được (Config::DEFAULTS->timeout = 30).

Partial Function Application là thay đổi đáng viết code thử ngay. Trước đây, muốn cố định một phần tham số phải viết closure thủ công; giờ chỉ cần dấu ?:

$versions = ['8.4', '8.5', '8.6', '8.7', '9.0'];

// Trước 8.6: phải bọc bằng arrow function
$supportsPfa = array_filter(
    $versions,
    fn ($version) => version_compare($version, '8.6', '>='),
);

// PHP 8.6: dùng ? làm chỗ giữ cho tham số còn lại
$supportsPfa = array_filter(
    $versions,
    version_compare(?, '8.6', '>='),
);

Dấu ? cũng dùng được với tham số đặt tên, ví dụ backoff(..., attempt: ?) — hàm chỉ thực sự chạy khi Closure nhận đủ tham số còn lại.

Khác gì bản trước

PHP 8.5 (ra mắt năm ngoái) chủ yếu là bổ sung nhỏ; PHP 8.6 là bản phát hành lớn thường niên, thay đổi cả cách viết code hằng ngày lẫn nền tảng async. Ba điểm khác biệt thực chất nhất:

  • PFA thay thế mẫu fn (...) => lặp đi lặp lại trong callback, array_map, array_filter — code ngắn hơn và đọc đúng ý đồ hơn.
  • Time\Duration thay cho số nguyên micro giây trong timeout, backoff, benchmark — hết cảnh nhầm đơn vị giây/mili/micro giây.
  • Io\Poll thay cho stream_select() vốn giới hạn khoảng 1.024 kết nối — mở đường cho server PHP xử lý nhiều kết nối đồng thời hơn mà không cần extension ngoài.

Về quy mô thay đổi: bản này thêm 17 hàm, 24 class, 15 enum, 47 hằng và 1 interface mới; đồng thời deprecated 26 hàm và 2 hằng, gỡ bỏ 2 extension, 15 hàm và 2 class. Nghĩa là dự án cũ nâng cấp lên 8.6 gần như chắc chắn sẽ gặp cảnh báo deprecated cần dọn.

Giá và thời điểm dùng được

PHP 8.6.0 đã tải được ngay từ php.net từ ngày 19/11, miễn phí và mã nguồn mở như mọi bản PHP. Theo chu kỳ hỗ trợ chuẩn của PHP, bản này dự kiến được hỗ trợ tới cuối 2028 và vá bảo mật tới cuối 2030. Lưu ý: PHP 8.6 ra mắt cùng ngày với loạt bản vá bảo mật 8.2.36, 8.3.37, 8.4.28 và 8.5.13 (17 CVE, trong đó 7 critical) — những bản vá này đã được cảnh báo tối 19/11, và nếu bạn chưa lên 8.6 thì cập nhật bản vá cho nhánh đang chạy trước đã.

Ai nên thử

Mọi dev PHP, đặc biệt team đang chạy Laravel, Symfony hoặc WordPress — nhưng theo hướng thử nghiệm có kiểm soát: chạy test suite trên PHP 8.6 trong CI trước, quét deprecation, rồi mới tính chuyện đưa lên staging. Các thư viện async như ReactPHP và AMPHP sẽ là bên hưởng lợi trực tiếp từ Io\Poll, nên team làm realtime/websocket nên theo dõi các bản cập nhật của chúng trong vài tuần tới.

Việc cần làm 1. Chạy test suite trên PHP 8.6 trong CI (để chế độ allowed-to-fail trước) để thấy deprecation và lỗi tương thích trước khi nâng cấp thật. 2. Quét danh sách deprecated: 26 hàm và 2 hằng bị deprecated, 2 extension và 15 hàm bị gỡ — sửa trước khi lên production. 3. Nếu chưa lên 8.6: cập nhật ngay bản vá bảo mật ngày 19/11 cho nhánh đang chạy (8.2.36 / 8.3.37 / 8.4.28 / 8.5.13) — đừng đợi nâng cấp lớn mới vá. 4. Đọc migration guide trên php.net trước khi nâng cấp production, đặc biệt phần thay đổi hành vi mặc định của session và stream.

*Nguồn: https://www.php.net/releases/8.6/en.php*

After 7 release candidates, PHP 8.6 officially shipped on November 19 — and this is no routine patch release. The most notable feature is Partial Function Application, which rewrites how PHP developers write callbacks; alongside it come a standard Duration type for measuring time, a new polling API for asynchronous programming, and a clamp() function that almost every developer has hand-rolled at some point with min(max(...)).

Key specs

FeatureIn short
Partial Function ApplicationCall a function with part of its arguments, using ? as a placeholder, and get back a Closure waiting for the rest
Time\DurationA standard duration type, precise to the nanosecond, able to represent more than 250 years — replacing scattered microsecond numbers
Polling API (Io\Poll)Monitor many streams at once using epoll/kqueue/WSAPoll, a common foundation for ReactPHP and AMPHP
clamp()Keep a value within a given range, usable with both numbers and Duration
SortDirection enumA standard, type-safe way to express sort order, replacing scattered SORT_ASC/SORT_DESC
Readonly property defaultsReadonly properties can now declare a default value, with no need to assign them in the constructor
New stream error handlingStream errors become structured StreamException/StreamError, replacing scattered warnings
#[\Override] for constantsThis attribute can now be used for class constants and enum cases
Post-quantum SodiumAdds X-Wing and ML-KEM-768, IP address encryption, and the SHAKE and TurboSHAKE functions

What's new

There are also Uri builders (Uri\Rfc3986\UriBuilder, Uri\WhatWg\UrlBuilder), a separate DocComment for each function parameter (read via ReflectionParameter::getDocComment()), and object properties in constants can now be modified directly (Config::DEFAULTS->timeout = 30).

Partial Function Application is the change worth trying in code right away. Previously, fixing part of the arguments meant writing a manual closure; now all it takes is the ?:

$versions = ['8.4', '8.5', '8.6', '8.7', '9.0'];

// Before 8.6: had to wrap in an arrow function
$supportsPfa = array_filter(
    $versions,
    fn ($version) => version_compare($version, '8.6', '>='),
);

// PHP 8.6: use ? as a placeholder for the remaining argument
$supportsPfa = array_filter(
    $versions,
    version_compare(?, '8.6', '>='),
);

The ? also works with named arguments, e.g. backoff(..., attempt: ?) — the function only actually runs once the Closure receives all the remaining arguments.

What changed vs the previous version

PHP 8.5 (released last year) was mostly small additions; PHP 8.6 is the big annual release, changing both everyday coding habits and the async foundation. The three most substantive differences:

  • PFA replaces the repetitive fn (...) => pattern in callbacks, array_map, array_filter — code is shorter and reads closer to its intent.
  • Time\Duration replaces integer microseconds in timeouts, backoff, benchmarks — no more second/millisecond/microsecond unit mix-ups.
  • Io\Poll replaces stream_select(), which is limited to about 1,024 connections — paving the way for PHP servers to handle more concurrent connections without external extensions.

On the scale of change: this release adds 17 new functions, 24 classes, 15 enums, 47 constants and 1 interface; at the same time it deprecates 26 functions and 2 constants, and removes 2 extensions, 15 functions and 2 classes. That means an old project upgrading to 8.6 will almost certainly hit deprecation warnings that need cleaning up.

Price and availability

PHP 8.6.0 has been downloadable from php.net since November 19, free and open source like every PHP release. Under PHP's standard support cycle, this release is expected to be supported until the end of 2028 and receive security patches until the end of 2030. Note: PHP 8.6 launched on the same day as the series of security patches 8.2.36, 8.3.37, 8.4.28 and 8.5.13 (17 CVEs, 7 of them critical) — those patches were flagged on the evening of November 19, and if you are not moving to 8.6 yet, update the patch for the branch you are running first.

Who should try it

Every PHP developer, especially teams running Laravel, Symfony or WordPress — but in a controlled, experimental way: run the test suite on PHP 8.6 in CI first, scan the deprecations, and only then think about moving to staging. Async libraries such as ReactPHP and AMPHP will benefit directly from Io\Poll, so teams doing realtime/websocket work should watch their updates over the coming weeks.

What to do 1. Run your test suite on PHP 8.6 in CI (in allowed-to-fail mode first) to surface deprecations and compatibility errors before a real upgrade. 2. Scan the deprecation list: 26 functions and 2 constants are deprecated, 2 extensions and 15 functions removed — fix them before going to production. 3. If you are not on 8.6 yet: update the November 19 security patch for the branch you are running right away (8.2.36 / 8.3.37 / 8.4.28 / 8.5.13) — do not wait for the big upgrade to patch. 4. Read the migration guide on php.net before upgrading production, especially the section on changed default behaviour for sessions and streams.

*Source: https://www.php.net/releases/8.6/en.php*

Nguồn tham chiếuSource: php.net

Đăng bàiPostXem bài viết gốcView original article

Đọc tiếpKeep reading

Ảnh bìa bài viết: GitHub giới thiệu Replica và Open Source Accessibility Framework cho mã nguồn mở
Ảnh: GitHub Blog — The best things in open source are built togetherẢnh: GitHub Blog — The best things in open source are built together
Công nghệ & DevTech & DevQuốc tếInternational

GitHub giới thiệu Replica và Open Source Accessibility Framework cho mã nguồn mởGitHub introduces Replica and the Open Source Accessibility Framework for open source

Công nghệ & DevTech & Dev · GitHub Blog · Quốc tếInternational · 20/11

GitHub giới thiệu Replica và Open Source Accessibility Framework, các dự án mã nguồn mở mới nhằm hỗ trợ hợp tác và hòa nhập.GitHub introduced Replica and the Open Source Accessibility Framework, new open source projects to support collaboration and inclusion.

Ảnh bìa bài viết: Cloudflare ghi nhận lưu lượng và tấn công mạng trong bầu cử giữa kỳ Mỹ 2026 từ hơn 1.400 trang được bảo vệ
Ảnh: Cloudflare Blog — Internet traffic and attacks during the 2026 U.S. midterm electionsẢnh: Cloudflare Blog — Internet traffic and attacks during the 2026 U.S. midterm elections
HOTCông nghệ & DevTech & DevQuốc tếInternational

Cloudflare ghi nhận lưu lượng và tấn công mạng trong bầu cử giữa kỳ Mỹ 2026 từ hơn 1.400 trang được bảo vệCloudflare records Internet traffic and attacks during the 2026 U.S. midterm elections from more than 1,400 protected sites

Công nghệ & DevTech & Dev · Cloudflare Blog · Quốc tếInternational · 20/11

Cloudflare phân tích dữ liệu từ hơn 1.400 trang được bảo vệ về lưu lượng Internet và các cuộc tấn công mạng trong ngày bầu cử giữa kỳ Mỹ 3/11/2026.Cloudflare analyzed data from more than 1,400 protected sites on Internet traffic and cyberattacks on the day of the U.S. midterm elections on November 3, 2026.

Ảnh bìa bài viết: Lỗ hổng zero-day vCenter CVE-2026-123890 (CVSS 9.8): nhóm APT khai thác hơn 2 tháng, Broadcom vá khẩn — không có workaround
Ảnh: The Hacker News — Critical VMware vCenter Flaw (CVSS 9.8) Lets Network Attackers Bypass AuthenticationẢnh: The Hacker News — Critical VMware vCenter Flaw (CVSS 9.8) Lets Network Attackers Bypass Authentication
HOTCông nghệ & DevTech & DevQuốc tếInternational

Lỗ hổng zero-day vCenter CVE-2026-123890 (CVSS 9.8): nhóm APT khai thác hơn 2 tháng, Broadcom vá khẩn — không có workaroundvCenter zero-day CVE-2026-123890 (CVSS 9.8): APT group exploited it for over 2 months, Broadcom ships emergency patch — no workaround

Công nghệ & DevTech & Dev · The Hacker News · Quốc tếInternational · 20/11

Một nhóm tấn công có liên hệ với Trung Quốc (ARMORY CASTLE) đã khai thác lỗ hổng zero-day CVE-2026-123890 (CVSS 9.8) trong VMware vCenter suốt hơn hai tháng trước khi có bản vá. Broadcom công bố bản sửa ngày 19/11/2026 và xếp đây là thay đổi khẩn cấp: không có workaround nào, cách duy nhất là vá ngay và rà soát dấu hiệu xâm nhập.A China-linked threat group (ARMORY CASTLE) exploited the CVE-2026-123890 zero-day (CVSS 9.8) in VMware vCenter for more than two months before a patch existed. Broadcom released fixes on 19 November 2026 and classed the flaw as an emergency change: there is no workaround, so patching immediately and hunting for signs of compromise is the only path.