Last modified: 2013-06-04 14:45:53 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T46027, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44027 - array_diff_assoc only compares strings
array_diff_assoc only compares strings
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Jeroen De Dauw
:
: 42691 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-16 09:41 UTC by s7eph4n
Modified: 2013-06-04 14:45 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Replace array_diff_assoc (1.99 KB, patch)
2013-01-16 09:41 UTC, s7eph4n
Details

Description s7eph4n 2013-01-16 09:41:25 UTC
Created attachment 11633 [details]
Replace array_diff_assoc

The array_diff_assoc in SMWSQLStore3Writers::preparePropertyTableUpdates is not going to work, because it does not work recursively. Instead it just uses string representations of the top-level elements. Which are all "Array" or some such for an array of arrays.

The attached patch should fix this. It might be faster though instead of having a loop in a loop in PHP to simply delete all old values from the DB and add all new values, i.e. delete and re-insert values even if they do not change.

(Sorry, I can not push from here. SSH port is blocked. Could somebody apply the patch?)

Semantic MediaWiki (Version 1.9 alpha) 	(0e1afb0)
Comment 1 Jeroen De Dauw 2013-01-17 10:46:12 UTC
Thanks for the patch. I also just ran into this. Not the only thing that's broken though. Even if you diff correctly, the input data does not have matching format:

var_dump($oldTableData,$newData); // line 383

array (size=1)
  0 => 
    array (size=3)
      's_id' => string '51' (length=2)
      'o_serialized' => string '1/2013/1/10/15/25/28' (length=20)
      'o_sortkey' => string '2456303.1426852' (length=15)

array (size=2)
  'smw_fpt_ask' => 
    array (size=1)
      0 => 
        array (size=2)
          's_id' => string '51' (length=2)
          'o_id' => string '737' (length=3)
  'smw_fpt_mdat' => 
    array (size=1)
      0 => 
        array (size=3)
          's_id' => string '51' (length=2)
          'o_serialized' => string '1/2013/1/17/10/41/53' (length=20)
          'o_sortkey' => float 2456309.9457523
Comment 2 s7eph4n 2013-01-17 10:51:05 UTC
Yes. Which is why I use == in the patch instead of ===. Seems the easiest solution, unless you want to change all the DIs to use string values.
Comment 3 Jeroen De Dauw 2013-01-17 10:51:51 UTC
https://gerrit.wikimedia.org/r/#/c/44389/
Comment 4 Jeroen De Dauw 2013-01-18 12:59:41 UTC
Thanks for the fix :)
Comment 5 Mark A. Hershberger 2013-06-04 14:45:53 UTC
*** Bug 42691 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links