Skip to content

cli/get_set_process_title fails on MacOS #11246

Closed

Description

@lucasnetau

Description

The following code:

<?php
if (cli_set_process_title("title") === true &&
    cli_get_process_title() === "title")
  echo "Successfully set title\n";

Resulted in this output:

PHP Warning:  cli_set_process_title(): cli_set_process_title had an error: Not initialized correctly
PHP Warning:  cli_get_process_title(): cli_get_process_title had an error: Not initialized correctly

But I expected this output instead:

Successfully set title

What was strange with this one it works from bash shells within PHPStorm, but fails on subprocesses (proc_open) or when php cli run from Terminal.

Tracing the issue finds that there may not be a contiguous environ strings following argv, however comparing to the original postgres version and checking the existing source this doesn't appear to be necessary to fail at this point.

I'll raise a PR shortly

PHP Version

PHP 8.1, PHP8.2

Operating System

MacOS

Activity

  1. added 2 commits that reference this issue on May 16, 2023
  2. lucasnetau commented on May 31, 2023

    @lucasnetau
    ContributorAuthor

    Is there anyone who can triage this? 2 PRs have been submitted for PHP8.1 (#11247), and PHP8.2 (#11273).

    I find projects that have patched over this by just ignoring Darwin based OS for example Synfony Console symfony/symfony#21076

  3. iluuu1994 commented on May 31, 2023

    @iluuu1994
    Member

    @lucasnetau I have an old Mac and so I'll have a look today.

  4. lucasnetau commented on May 31, 2023

    @lucasnetau
    ContributorAuthor

    Thank you. I only have macOS 13.3 boxes around but I replicated on both Intel and M1. The target version in CI is only 11 for macOS.

  5. iluuu1994 commented on May 31, 2023

    @iluuu1994
    Member

    Fixed in c6ae7a5.

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