Skip to content

XP_SOCKET XP_SSL (Socket stream modules): Incorrect condition for Win32/Win64 #19798

Closed

Description

@EdmondDantes

if (clisock >= 0) {

	if (clisock >= 0) {

This condition will never be true on Windows, because the type php_socket_t is UINT_PTR, and the value -1 will always be greater than zero.

Correct fix: introduce the INVALID_SOCKET constant for both platforms.

⚠️ This issue causes timeout warnings not to be displayed on Windows.

Activity

  1. changed the title [-]Incorrect condition for Win32/Win64[/-] [+]XP_SOCKET XP_SSL (Socket stream modules): Incorrect condition for Win32/Win64[/+] on Sep 11, 2025
  2. EdmondDantes commented on Sep 11, 2025

    @EdmondDantes
    ContributorAuthor
  3. bukka commented on Sep 19, 2025

    @bukka
    Member

    Good that you noticed this master regression that was introduced in #19106 . It's actually not an issue on lower branches and xp_ssl where int was used but that master refactoring changed type. The behavior wasn't really correct on lower branches anyway as it was relying on implementation defined behavior (changing signedness when casting unsigned to signed) so I created a fix for that in #19881.

    Btw. there is already SOCK_ERR for what you described...

  4. bukka commented on Sep 19, 2025

    @bukka
    Member

    Sorry linked the wrong issue before (edited now): Fix is in #19881

  5. added 3 commits that reference this issue on Oct 23, 2025
    eef11e0
    2a0931d
    4545174
  6. added a commit that references this issue on Oct 23, 2025
    b3d8465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions