ZF-4957: Problems with german Umlauts and getUserPosts() without tag in search query

Description

I encounterd two bugs in Zend_Service_Delicious. First: Trying: $posts = $delicious->getUserPosts('user'); As soon an german umlaut like ä,ü,ö exists in title, description or tag you get an error:

Fatal error: Uncaught exception 'Zend_Json_Exception' with message 'Illegal escape sequence 'u'' in....[ ]....\application\library\Zend\Json\Decoder.php on line 386

Seems to be more a problem with json_decode.

Second error/bug: When searching for posts from a user, assuming no german umlauts are given, so that the first error will not occur everything works fine when searching for a post and a tag like: $posts = $delicious->getUserPosts('user', 'null', 'webdesign');

But searching without a tag: $posts = $delicious->getUserPosts('user', '1', null); Error: Fatal error: Uncaught exception 'Zend_Service_Delicious_Exception' with message 'Http client reported an error: 'Not Found''

In /Zend/Service/Delicious.php line 494 changing $response = $this->_rest->restGet($path, $parms); to $response = $this->_rest->restGet(rtrim($path,'/'), $parms); would solve this error, since in line 78 const JSON_POSTS = '/feeds/json/%s/%s'; has an ending slash in the url when no tag is given. Delicious feed seems to no like an ending slash.

Comments

I have the same problem.

here's another testcase

p.php

set_include_path( '/opt/local/lib/php/' . PATH_SEPARATOR . get_include_path() ); require_once "Zend/Loader.php"; Zend_Loader::registerAutoload(); $d = new Zend_Service_Delicious(); $tags = $d->getUserTags('osde.info');

$ php p.php

Fatal error: Uncaught exception 'Zend_Json_Exception' with message 'Illegal escape sequence 'u'' in /opt/local/lib/php/Zend/Json/Decoder.php:386 Stack trace:

0 /opt/local/lib/php/Zend/Json/Decoder.php(231): Zend_Json_Decoder->_getNextToken()

1 /opt/local/lib/php/Zend/Json/Decoder.php(177): Zend_Json_Decoder->_decodeObject()

2 /opt/local/lib/php/Zend/Json/Decoder.php(159): Zend_Json_Decoder->_decodeValue()

3 /opt/local/lib/php/Zend/Service/Delicious.php(520): Zend_Json_Decoder::decode('{"!":1,"!!":1,"...')

4 /opt/local/lib/php/Zend/Service/Delicious.php(403): Zend_Service_Delicious->makeRequest('/feeds/json/tag...', Array, 'json')

5 /Users/clive/Documents/workspace/p.php(11): Zend_Service_Delicious->getUserTags('osde.info')

6 {main}

thrown in /opt/local/lib/php/Zend/Json/Decoder.php on line 386

and i was using 1.7.6

Previously fixed as part of ZF-3395 in r14399