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

Fixed infinite save loop #16395 #16399

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Fixed infinite save loop #16395 #16399

merged 1 commit into from
Aug 29, 2023

Conversation

rudiservo
Copy link
Contributor

@rudiservo rudiservo commented Aug 10, 2023

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Small description of change:
Added an array with already visited objects by the save or the SaveRelated chain functions in order to avoid save loops
Performance Tests where made between SplObjectStorage and the PHP Array.
There are two function to get a unique ID from a Php object, spl_object_hash and spl_object_id.
Using spl_object_hash, SplObjectStorage is faster and uses less memory, spl_object_storage is the function SplObjectStorage uses.
Using the spl_object_id the php Array is faster and uses less memory by a small margin, however since Zephir cannot pass by reference, SplObjectStorage is the better option.

Thanks

@rudiservo rudiservo force-pushed the i16395 branch 4 times, most recently from dafc84f to bc23560 Compare August 10, 2023 18:05
phalcon/Mvc/Model.zep Outdated Show resolved Hide resolved
phalcon/Mvc/Model.zep Outdated Show resolved Hide resolved
phalcon/Mvc/Model.zep Outdated Show resolved Hide resolved
@rudiservo rudiservo force-pushed the i16395 branch 3 times, most recently from a4fccd4 to a002502 Compare August 11, 2023 22:05
@Jeckerson
Copy link
Member

@rudiservo please rebase this branch.

@rudiservo
Copy link
Contributor Author

@Jeckerson I think it's ok now.

@rudiservo rudiservo force-pushed the i16395 branch 5 times, most recently from c8515e0 to aeb5ed9 Compare August 15, 2023 20:44
@niden niden merged commit d5a12bf into phalcon:5.0.x Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants