Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/get_set_process_title fails on MacOS #11246

Closed
lucasnetau opened this issue May 16, 2023 · 4 comments
Closed

cli/get_set_process_title fails on MacOS #11246

lucasnetau opened this issue May 16, 2023 · 4 comments

Comments

@lucasnetau
Copy link
Contributor

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

lucasnetau added a commit to lucasnetau/php-src that referenced this issue May 16, 2023
Fail to clobber_error only when the argv is a non-contiguous area
Don't increment the end_of_error if a non-contiguous area is encountered in environ
lucasnetau added a commit to lucasnetau/php-src that referenced this issue May 19, 2023
@lucasnetau
Copy link
Contributor Author

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

@iluuu1994
Copy link
Member

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

@lucasnetau
Copy link
Contributor Author

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.

iluuu1994 pushed a commit that referenced this issue May 31, 2023
Fail to clobber_error only when the argv is a non-contiguous area
Don't increment the end_of_error if a non-contiguous area is encountered in environ

Closes GH-11247
iluuu1994 added a commit that referenced this issue May 31, 2023
* PHP-8.1:
  Fix bug GH-11246 cli/get_set_process_title
iluuu1994 added a commit that referenced this issue May 31, 2023
* PHP-8.2:
  Fix bug GH-11246 cli/get_set_process_title
@iluuu1994
Copy link
Member

Fixed in c6ae7a5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants