Skip to content

Commit

Permalink
Merge pull request #109 from mjrider/issue-108
Browse files Browse the repository at this point in the history
Fix for issue 108
  • Loading branch information
poef committed May 10, 2016
2 parents e5ef44a + 70c8451 commit 29e0f1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ar/url.php
Expand Up @@ -101,7 +101,7 @@ public function __call( $name, $arguments ) {
}
}

public function __get( $name ) {
public function &__get( $name ) {
return $this->query->{$name};
}

Expand Down Expand Up @@ -129,7 +129,7 @@ public function offsetExists($name){
return isset($this->query->{$name});
}

public function offsetGet($name) {
public function &offsetGet($name) {
return $this->query->{$name};
}

Expand Down
14 changes: 14 additions & 0 deletions tests/unit/ar/url.php
Expand Up @@ -116,4 +116,18 @@ function testParseCommonURLS()
$this->assertEquals( $sourceUrl, ''.$url );
}
}

function testArrayAccess() {
$base = 'https://www.ariadne-cms.org/';

$url = ar::url($base);
$url->query['test']['foo'] = 'bar';

$this->assertEquals( 'bar', $url->query['test']['foo']);
$this->assertEquals( $base . '?test%5Bfoo%5D=bar', (string)$url );

$url->query->test['bar'] = 'foo';
$this->assertEquals( 'foo', $url->query->test['bar']);
$this->assertEquals( $base . '?test%5Bfoo%5D=bar&test%5Bbar%5D=foo', (string)$url );
}
}

0 comments on commit 29e0f1a

Please sign in to comment.