Skip to content

Add support for bitwise string assign ops #1322

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

Closed
wants to merge 1 commit into from

Conversation

bwoebi
Copy link
Member

@bwoebi bwoebi commented Jun 4, 2015

$str[$off] OP= $x; equivalent to $str[$off] = $str[$off] OP $x;

Fixes fatal error for |=, ^= and &= on string offsets. Other people may feel free to add support for other ops, but I don't see any real sense in it (at least as long as we require the equality above to hold).
Changing that would need a RFC, hence this PR is only strictly doing what it does on e.g. array access too.

Behavior is: $str[$off] OP= $x; equivalent to $str[$off] = $str[$off] OP $x;
@weltling
Copy link
Contributor

weltling commented Jun 8, 2015

@bwoebi please add some tests.

Thanks.

@nikic
Copy link
Member

nikic commented Jun 10, 2015

For the record I'm -1 on this because imho we should either support all the operations that are supported in the long form or none of them, not something in between.

@weltling
Copy link
Contributor

@nikic, yeah, you're right ... my thought was either that to support the feature that makes sense by the meaning at least is acceptable, the other cases are still errored anyway.

An RFC were probably something standardizing the behavior, by the research some more useful cases can come out. This is pretty good for the overall specification. So I have to concur with your position. This PR is incomplete and needs an RFC which will produce the basis for the language specification.

Thanks.

@nikic nikic added the RFC label Jun 17, 2015
@php-pulls
Copy link

Comment on behalf of cmb at php.net:

Since this PR appears to be abandoned, and there is no respective RFC, I'm closing this PR for now.

@php-pulls php-pulls closed this Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants