kausha-mehta / php-twitter

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

followUser does not accept a string id #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The offending line is:

$request = 'http://twitter.com/friendships/create/' . (int) $id . '.' .
$this->type;

Which as you can see blindly casts to type integer something that the
comments expressly state should be a string or an int (see below). My fix
is to remove the type casting.

    /**
     * Sends a request to follow a user specified by ID
     * @param integer|string $id The twitter ID or screenname of the user to
follow
     * @param boolean $notifications Optional. If true, you will recieve
notifications from the users updates
     * @return string
     */
    function followUser( $id, $notifications = false )
    {
        if( !in_array( $this->type, array( 'xml','json' ) ) )
            return false;

        $request = 'http://twitter.com/friendships/create/' . (int) $id . '.' .
$this->type;
        if( $notifications )
            $request .= '?follow=true';

        return $this->objectify( $this->process($request) );
    }

Original issue reported on code.google.com by matt...@thanetstar.com on 23 Mar 2009 at 9:50

GoogleCodeExporter commented 8 years ago

Original comment by emmenset...@gmail.com on 24 Mar 2009 at 1:44