PRADHAN-P / php-twitter

Automatically exported from code.google.com/p/php-twitter
0 stars 0 forks source link

Status update failes if @ is the first character #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Update status with "@" as the first character
2. Example code:
<?php
$t = new twitter;
$t->username = 'user';
$t->password = 'password';

$data = $t->update('@anotherUser test1');
print '<pre>'; print_r($data); print '</pre>';
print '<pre>'; print_r($t->responseInfo); print '</pre>';
?>

What is the expected output? What do you see instead?
Typical response is expected but you see nothing instead.

What version of the product are you using? On what operating system?
v1.1 on Linux

Please provide any additional information below.
Fixed by using this code instead (note the space in front of the "@"):
<?php
$t = new twitter;
$t->username = 'user';
$t->password = 'password';

$data = $t->update(' @anotherUser test1');
print '<pre>'; print_r($data); print '</pre>';
print '<pre>'; print_r($t->responseInfo); print '</pre>';
?>

Original issue reported on code.google.com by matthew....@gmail.com on 5 Jul 2009 at 9:34

GoogleCodeExporter commented 9 years ago
Never mind, just saw issue #30.

Original comment by matthew....@gmail.com on 5 Jul 2009 at 9:40

GoogleCodeExporter commented 9 years ago
Yes, i've the same issue with my PHP script
(PHP 5.2)
The space, is the right solution.

Original comment by capri...@gmail.com on 12 Jul 2009 at 4:35

GoogleCodeExporter commented 9 years ago
I've fixed this problem in the Twitter class, just delete the last line of the
status() method and replace it with this:
        $keys = array_keys($postargs);
        $values = $postargs;
        $pairs = array();
        foreach($keys as $key) {
            array_push($pairs, $key.'='.$values[$key]);
        }
        return $this->objectify( $this->process($request, join('&',$pairs)) );

The reason is this bug: http://bugs.php.net/bug.php?id=50060
The above is just a workaround for a PHP bug :(

Original comment by mac.g...@gmail.com on 7 Nov 2009 at 3:08