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

Remove pass-by-ref #26442

Merged
merged 1 commit into from
Jun 6, 2023
Merged

Remove pass-by-ref #26442

merged 1 commit into from
Jun 6, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Remove pass-by-ref- pass by ref does nothing on objects

Before

image

After

poof

Technical Details

@civibot
Copy link

civibot bot commented Jun 5, 2023

(Standard links)

@civibot civibot bot added the master label Jun 5, 2023
@yashodha
Copy link
Contributor

yashodha commented Jun 6, 2023

@eileenmcnaughton looks good, merging this PR.

@demeritcowboy
Copy link
Contributor

This is probably safe in this context but note the & does do something for objects. Compare:

php -r "class A { public $foo = 1; } $a = new A(); $b = $a; $a = new A(); $a->foo = 2; echo $b->foo;"

outputs 1 since $b is still pointing to the original $a, but

php -r "class A { public $foo = 1; } $a = new A(); $b = &$a; $a = new A(); $a->foo = 2; echo $b->foo;"

outputs 2 since with the & $b is tied to $a even when $a is reassigned.

@demeritcowboy demeritcowboy merged commit 193f052 into civicrm:master Jun 6, 2023
@eileenmcnaughton eileenmcnaughton deleted the no_ref branch June 6, 2023 19:10
@colemanw
Copy link
Member

colemanw commented Jun 7, 2023

@demeritcowboy that's good to know! But something tells me that's not the reason the & was originally added...

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