Permalink
Browse files

Fix different array related stuff to avoid warnings

Initialize missing statements variable in QueryCache.php->invalidate
  • Loading branch information...
1 parent 902f58f commit 9eaf5263f8a12bc9ed9560b700e9716128c87ba3 @k00ni k00ni committed Feb 13, 2013
@@ -171,8 +171,14 @@ public function invalidateWithStatements( $modelIri, $statements = array() ) {
* @return int $count number of queries which was affected of the invalidation process
*/
public function invalidate( $modelIri, $subject, $predicate, $object ) {
+ // cast subject and predicate to string
+ $subject = (string) $subject;
+ $predicate = (string) $predicate;
+
+ // initialize statements array
$statements = array();
- $statements[$subject][$predicate][] = $object ;
+ $statements[$subject] = array();
+ $statements[$subject][$predicate] = array ($object);
$qids = $this->invalidateWithStatements($modelIri, $statements);
return $qids;
@@ -324,8 +324,8 @@ public function deleteMatchingStatements($graphUri, $subject, $predicate, $objec
} else {
$objectSpec = $this->buildLiteralString(
$object['value'],
- array_key_exists('datatype', $object) ? $object['datatype'] : null,
- array_key_exists('lang', $object) ? $object['lang'] : null
+ true == isset ($object['datatype']) ? $object['datatype'] : null,
+ true == isset ($object['lang']) ? $object['lang'] : null
);
}
} else {
@@ -349,13 +349,14 @@ public function onAddStatement(Erfurt_Event $event)
$this->_checkSetup();
if (is_array($event->statement)) {
- $payload = array (
- $event->statement['subject'] => array (
- $event->statement['predicate'] => array (
- $event->statement['object']
- )
- )
- );
+
+ $s = (string) $event->statement['subject'];
+ $p = (string) $event->statement['predicate'];
+ $o = $event->statement['object'];
+
+ $payload = array ();
+ $payload [$s] = array ();
+ $payload [$s][$p] = array ($o);
$payloadId = $this->_execAddPayload($payload);
$resource = $event->statement['subject'];

0 comments on commit 9eaf526

Please sign in to comment.