shmop_close doesn't delete the memory segment, it just detaches from it.
If you have created the block and need to delete it you must call shmop_delete **BEFORE** calling shmop_close (for reasons outlined in shmop_delete help page notes).(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
shmop_close β ΠΠ°ΠΊΡΡΠ²Π°Π΅Ρ Π±Π»ΠΎΠΊ ΡΠ°Π·Π΄Π΅Π»ΡΠ΅ΠΌΠΎΠΉ ΠΏΠ°ΠΌΡΡΠΈ
ΠΠ°ΡΠΈΠ½Π°Ρ Ρ PHP 8.0.0 ΡΡΠ½ΠΊΡΠΈΡ Π£Π‘Π’ΠΠ ΠΠΠ. ΠΠΎΠ»Π°Π³Π°ΡΡΡΡ Π½Π° ΡΡΠ½ΠΊΡΠΈΡ Π½Π°ΡΡΠΎΡΡΠ΅Π»ΡΠ½ΠΎ Π½Π΅ ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡΡΡ.
ΠΠ°ΠΌΠ΅ΡΠ°Π½ΠΈΠ΅: Π€ΡΠ½ΠΊΡΠΈΡ ΡΡΠ°Π»Π° Π±Π΅ΡΠΏΠΎΠ»Π΅Π·Π½ΠΎΠΉ. ΠΠΎ PHP 8.0.0 ΡΡΠ½ΠΊΡΠΈΡ Π·Π°ΠΊΡΡΠ²Π°Π»Π° ΡΠ΅ΡΡΡΡ.
Π€ΡΠ½ΠΊΡΠΈΡ shmop_close() ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΡΡ Π·Π°ΠΊΡΡΠ²Π°Π΅Ρ Π΄ΠΎΡΡΡΠΏΠ° ΠΊ Π±Π»ΠΎΠΊΡ ΡΠ°Π·Π΄Π΅Π»ΡΠ΅ΠΌΠΎΠΉ ΠΏΠ°ΠΌΡΡΠΈ.
shmopΠ€ΡΠ½ΠΊΡΠΈΡ Π½Π΅ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΠΏΠΎΡΠ»Π΅ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ.
| ΠΠ΅ΡΡΠΈΡ | ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ |
|---|---|
| 8.0.0 | Π€ΡΠ½ΠΊΡΠΈΡ ΡΡΡΠ°ΡΠ΅Π»Π°, ΠΏΠΎΡΠΊΠΎΠ»ΡΠΊΡ Π±ΠΎΠ»ΡΡΠ΅ Π½ΠΈ Π½Π° ΡΡΠΎ Π½Π΅ Π²Π»ΠΈΡΠ΅Ρ. |
| 8.0.0 |
ΠΠ°ΡΠ°ΠΌΠ΅ΡΡ shmop ΠΎΠΆΠΈΠ΄Π°Π΅Ρ ΡΠΊΠ·Π΅ΠΌΠΏΠ»ΡΡ ΠΊΠ»Π°ΡΡΠ° Shmop;
ΡΠ°Π½ΡΡΠ΅ ΠΎΠΆΠΈΠ΄Π°Π»ΡΡ ΡΠ΅ΡΡΡΡ (resource).
|
ΠΡΠΈΠΌΠ΅Ρ #1 ΠΡΠΈΠΌΠ΅Ρ Π·Π°ΠΊΡΡΡΠΈΡ Π±Π»ΠΎΠΊΠ° ΡΠ°Π·Π΄Π΅Π»ΡΠ΅ΠΌΠΎΠΉ ΠΏΠ°ΠΌΡΡΠΈ
<?php
shmop_close($shm_id);
?>
Π ΠΏΡΠΈΠ²Π΅Π΄ΡΠ½Π½ΠΎΠΌ ΠΏΡΠΈΠΌΠ΅ΡΠ΅ Π·Π°ΠΊΡΡΠ²Π°Π΅ΡΡΡ Π΄ΠΎΡΡΡΠΏ ΠΊ Π±Π»ΠΎΠΊΡ ΠΎΠ±ΡΠ΅ΠΉ ΠΏΠ°ΠΌΡΡΠΈ
Ρ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡΠΎΠΌ $shm_id.
shmop_close doesn't delete the memory segment, it just detaches from it.
If you have created the block and need to delete it you must call shmop_delete **BEFORE** calling shmop_close (for reasons outlined in shmop_delete help page notes).As explained on this page, PHP 8.0.0 expects a Shmop instance instead of a resource. According to bug #81098 this change means that the Shmop closes itself when the script completes so there is no need to close it with shmop_close.
Using function_exists('shmop_close') will return true but calling shmop_close will throw a deprecation error.
The documentation explains the change in 8.0.0 expects the expected argument changed without mentioning it'll just throw a deprecation error.