Skip to content

str_word_count behaves differently on macos 14 vs 15+ #19828

@DanielRuf

Description

@DanielRuf

Description

The following code:

<?php

echo str_word_count('мама', 0, null);

Resulted in this output:

4

But I expected this output instead:

0

It seems the issue started appearing in macos 15+:
https://github.com/DanielRuf/msphpsql-issue/actions/runs/17699243588/job/50302685774 (macos 14 is green)
https://github.com/DanielRuf/msphpsql-issue/actions/runs/17699284860/job/50302784288 (macos 15 is red)

See also the discussion at microsoft/msphpsql#1532

I could only test via GitHub Actions and https://github.com/shivammathur/setup-php since I do not own a Macbook anymore. So this needs further testing to verify, if this is really an issue with the original PHP releases or only with custom built releases using tools like homebrew (which compiles PHP from source if no matching binary is available).

PHP Version

PHP 8.4.12 (cli) (built: Aug 26 2025 13:36:28) (NTS)
Copyright (c) The PHP Group
Built by Shivam Mathur
Zend Engine v4.4.12, Copyright (c) Zend Technologies

Operating System

macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions