janus-ssp / janus

Fully featured metadata registration administration module built on top of simpleSAMLphp.
Other
13 stars 8 forks source link

Fix missing/null array2 when comparing arrays #599

Closed mrvanes closed 8 years ago

mrvanes commented 8 years ago

While bootstrapping Janus with some imported metadata, janus_array_diff_recursive broke on missing/empty $array2. The result should be $array1.

thijskh commented 8 years ago

Makes me wonder if this is supposed to happen and therefore if it's good to ignore/fix this quietly.

mrvanes commented 8 years ago

It happened when importing metadata from xml IIRC, that's why I fixed it.

mrvanes commented 8 years ago

It happens (for me) on importing XML metadata for an SP that was bootstrapped only by entering entityID before:

Mar 24 10:12:25 openconext simplesamlphp[1475]: 3 [435a12d232] SimpleSAML_Error_Exception: Error 2 - Invalid argument supplied for foreach()
Mar 24 10:12:25 openconext simplesamlphp[1475]: 3 [435a12d232] Backtrace:
Mar 24 10:12:25 openconext simplesamlphp[1475]: 3 [435a12d232] 3 /opt/OpenConext/simplesamlphp-1.13.2/www/_include.php:70 (SimpleSAML_error_handler)
Mar 24 10:12:25 openconext simplesamlphp[1475]: 3 [435a12d232] 2 /opt/OpenConext/simplesamlphp-1.13.2/modules/janus/www/importentity.php:233 (janus_array_diff_recursive)
Mar 24 10:12:25 openconext simplesamlphp[1475]: 3 [435a12d232] 1 /opt/OpenConext/simplesamlphp-1.13.2/modules/janus/www/importentity.php:224 (require)
Mar 24 10:12:25 openconext simplesamlphp[1475]: 3 [435a12d232] 0 /opt/OpenConext/simplesamlphp-1.13.2/www/module.php:134 (N/A)

The reason you haven't noticed is because Janus continues anyway. templates/importentity.php fails silently as well, so added fix for that.