GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix test to use non-interned string by rr-it · Pull Request #25370 · php/php-src

Conversation

@rr-it

@rr-it rr-it commented Nov 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

This changes the test-case to actually use a non-interned string.

This construct actually becomes an interned string after optimizations applied in 93fd714:

$str = str_repeat("my valid string", random_int(1, 1));

php-src/ext/standard/string.c

Lines 5641 to 5643 in 93fd714

if (mult == 1) {
RETURN_STR_COPY(input_str);
}


Further random_int(1, 1) is optimized since PHP 7:

php-src/ext/standard/random.c

Lines 171 to 173 in c12917a

if (min == max) {
RETURN_LONG(min);
}

Implemented with c12917a and further refactored with b14dd85 and 4d8dd8d.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rr-it
rr-it requested a review from devnexen as a code owner November 10, 2026 13:50
@github-actions github-actions Bot added the Extension: dom label Nov 10, 2026
@ndossche

ndossche commented Nov 10, 2026

Copy link
Copy Markdown
Member

Wrong commit pointed, str_repeat got optimized such that passing 1 returns the input string, that's the root cause not the ext/random changes.
Your alternative doesn't work because of SCCP.
Also, many tests rely on the old str_repeat+random_int trick. The simplest fix is likely to change the randomness bounds to 2,2

rr-it reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rr-it

rr-it commented Nov 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

The simplest fix is likely to change the randomness bounds to 2,2

@ndossche That one fixes it. Do you add a new PR or shall I?


Your alternative doesn't work because of SCCP.

This alternative actually works to create non-interned strings:

$strInterned = "my valid";
$strNonInterned = $strInterned . " string";

Also see:
#25371

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rr-it
rr-it force-pushed the fix/testcase-non-interned-string branch 2 times, most recently from e468c25 to 4fedde6 Compare November 10, 2026 14:22
@ndossche

ndossche commented Nov 10, 2026

Copy link
Copy Markdown
Member

This made it into 8.6, so the target branch should be PHP-8.6. You may do the fixes in this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rr-it
Fix test to use non-interned string
b31b3bc
@rr-it
rr-it force-pushed the fix/testcase-non-interned-string branch from 4fedde6 to b31b3bc Compare November 10, 2026 19:14
@rr-it
rr-it changed the base branch from master to PHP-8.6 November 10, 2026 19:15
@rr-it

rr-it commented Nov 10, 2026

Copy link
Copy Markdown
Author

Commit rebased on branch PHP-8.6 and PR changed to target branch PHP-8.6.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@devnexen devnexen Awaiting requested review from devnexen devnexen is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Extension: dom

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rr-it @ndossche
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.