|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-10 14:28 UTC] mitrickx at mail dot ru
-Status: Open
+Status: Closed
[2016-08-10 14:28 UTC] mitrickx at mail dot ru
[2016-08-10 21:01 UTC] requinix@php.net
-Status: Closed
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 05:00:01 2026 UTC |
Description: ------------ $item = array ( 'id' => '21', 'sid' => NULL, 'parent_id' => '20', 'storage_id' => '10', 'name' => 'a_folder_filesFileModelTesttestMoveSmallTreeIntoFolder57ab2d09bfa17', 'left_key' => '4', 'right_key' => '5', 'depth' => '1', 'contact_id' => '504', 'size' => '0', 'count' => '1', 'ext' => NULL, 'type' => 'folder', 'create_datetime' => '2016-08-10 16:32:57', 'update_datetime' => '2016-08-10 16:32:57', 'hash' => '75eaadd1fbbd5ecf467f7e7bc2bd8e61', 'source_id' => '4', 'source_inner_id' => NULL, 'source_path' => NULL, 'mark' => NULL, 'in_copy_process' => '0', ); $prev_item = array ( 'id' => '21', 'sid' => NULL, 'parent_id' => '20', 'storage_id' => '10', 'name' => 'a_folder_filesFileModelTesttestMoveSmallTreeIntoFolder57ab2d09bfa17', 'left_key' => '4', 'right_key' => '5', 'depth' => '1', 'contact_id' => '504', 'size' => '0', 'count' => '1', 'ext' => NULL, 'type' => 'folder', 'create_datetime' => '2016-08-10 16:32:57', 'update_datetime' => '2016-08-10 16:32:57', 'hash' => NULL, 'source_id' => '0', 'source_inner_id' => NULL, 'source_path' => NULL, 'mark' => NULL, 'in_copy_process' => '0', ); var_dump(array_diff($item, $prev_item)); // Incorrect! // Array // ( // hash => '75eaadd1fbbd5ecf467f7e7bc2bd8e61' // ) // Must be // Array // ( // hash => '75eaadd1fbbd5ecf467f7e7bc2bd8e61' // source_id => '4' // ) // but when we change a little. 'source_id' was '4', now it is '6' $item['source_id'] = '6'; var_dump(array_diff($item, $prev_item)); // Correct // Array // ( // hash => '75eaadd1fbbd5ecf467f7e7bc2bd8e61' // source_id => '6' // ) // and come back to '4' again $item['source_id'] = '4'; // Tada!! Lol!! :) Incorrect again // Array // ( // hash => '75eaadd1fbbd5ecf467f7e7bc2bd8e61' // ) // just play with digits. Try '1', '2', '3', '4', '5', '6' Test script: --------------- // See bellow