And for completeness, here's the quick and dirty PDO version of the above 
(minus the insert for my Subscription object):

    public function saveSubscription(SubscriptionInterface $subscription, 
SignupInterface $signup, $flush = true)
    {
        $handle = \fopen('/home/lwprods/new/errors', 'w');

        $dsn = sprintf('%s:host=%s;dbname=%s', 'mysql', 'localhost', 
'database');
        $dbh = null;
        
        try
        {
            $dbh = new \PDO($dsn, 'username', 'password');
        }
        catch (PDOException $e)
        {
            \fwrite($handle, "Unable to connect to: $dsn");
            \fclose($handle);
            die;
        }
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
        
        $query = "INSERT INTO `database`.`signup` VALUES(:signup_id, 
:subscription_id)";
        $varList = array(':signup_id'       => (string)$signup->getId(),
                         ':subscription_id' => 
(string)$signup->getSubscriptionId());
        try
        {
            $stmt = $dbh->prepare($query);
            $execSuccess = $stmt->execute($varList);
            $sqlState = $stmt->errorInfo();
            
            if ($sqlState[0] == '00000' && $execSuccess)
            {
                \fwrite($handle, 'Success!');
            }
            else
            {
                throw new PDOException($sqlState[2], $sqlState[1]);
            }
            
            $stmt->closeCursor();
        }
        catch (PDOException $e)
        {
            \fwrite($handle, $e->getMessage());
            \fclose($handle);
            die;
        }
       
        \fclose($handle);
    }

Note that this completely fails without error when data is posted from an 
external URL. It works fine if I post data from a local script.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to