Doc->Req #76024 [Fbk->Opn]: Elements disappear After Interaction with SplHeap
| From: | mt at mfmello dot com | Date: | Wed, 28 Feb 2018 15:00:06 +0000 |
| Subject: | Doc->Req #76024 [Fbk->Opn]: Elements disappear After Interaction with SplHeap | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214142@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76024&edit=1
ID: 76024
User updated by: mt at mfmello dot com
Reported by: mt at mfmello dot com
Summary: Elements disappear After Interaction with SplHeap
-Status: Feedback
+Status: Open
-Type: Documentation Problem
+Type: Feature/Change Request
Package: SPL related
Operating System: Linux Mint 18.1 64bits
PHP Version: 7.0.27
Block user comment: N
Private report: N
New Comment:
Yes, I made the change.
This issue could be extended to any looping interaction in the spline data structures that come by
default by removing the current element after advancing to the next key in the array. So the
community would have more control over their data.
Original (pt-br):
Sim, fiz a alteração.
Essa questão poderia ser estendida para toda interação em loop nas estruturas de dados da
biblioteca Spl que venham por padrão removendo o elemento atual após avançar para a
próxima chave da matriz. Assim a comunidade teria mais poder de controle sobre seus dados.
Previous Comments:
------------------------------------------------------------------------
[2018-02-28 14:44:20] salathe@php.net
Do you want this ticket changed to a feature request, to provide that functionality?
------------------------------------------------------------------------
[2018-02-28 13:51:07] mt at mfmello dot com
It is actually provided in the documentation, but is it really by default that it should delete the
top object? Using the SplHeap::next method does not deduce that the object will be removed, but
rather that the array will simply be advanced one position forward. Even if this action were
expected for the programmers it would be very useful to be able to configure this as it does in the
SplDoublyLinkedList that we can change the mode of the Interator.
Original (pt-br):
Realmente está previsto na documentação, mas será que realmente por padrão ele
deveria deletar o objeto do topo? Utilizando o método SplHeap::next não se deduz que o objeto
será removido, mas sim que a matriz simplesmente será avançada uma posição a frente.
Mesmo que essa ação fosse esperada para os programadores seria muito útil poder configurar
isso assim como ocorre no SplDoublyLinkedList que podemos alterar o modo do interador.
------------------------------------------------------------------------
[2018-02-28 12:50:51] salathe@php.net
SplHeap::next() already documents that calling this method (which happens implicitly using foreach)
will delete the top node of the heap.
-- http://php.net/manual/en/splheap.next.php
------------------------------------------------------------------------
[2018-02-28 10:18:30] cmb@php.net
This behavior is by design[1]. Changing to doc bug.
[1]
<https://github.com/php/php-src/blob/PHP-7.2.3/ext/spl/spl_heap.c#L945-L961>
<https://github.com/php/php-src/blob/PHP-7.2.3/ext/spl/spl_heap.c#L885-L889>
------------------------------------------------------------------------
[2018-02-28 00:41:57] carusogabriel34 at gmail dot com
Confirmed: https://3v4l.org/pHeW0
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=76024
--
Edit this bug report at https://bugs.php.net/bug.php?id=76024&edit=1