Skip to content

cli/get_set_process_title fails on MacOS #11246

Closed
@lucasnetau

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

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