Issues

ZF-2258: Undefined variable in YouTube code, demo

Description

Testing revision 7026 with PHP 5.2.4 on Windows XP.

Found an undefined variable in Zend/Gdata/YouTube/VideoEntry.php.

The following diffs seems to resolve the issues. You can review and apply these fixes at your discretion.


$ svn diff library/Zend/Gdata/YouTube
Index: library/Zend/Gdata/YouTube/VideoEntry.php
===================================================================
--- library/Zend/Gdata/YouTube/VideoEntry.php   (revision 7026)
+++ library/Zend/Gdata/YouTube/VideoEntry.php   (working copy)
@@ -410,7 +410,7 @@
     {
         $fullId = $this->getId();
         $position = strrpos($fullId, '/');
-        if ($pos === false) {
+        if ($position === false) {
             require_once 'Zend/Gdata/App/Exception.php';
             throw new Zend_Gdata_App_Exception('Slash not found in atom:id');
         } else {

$ svn diff demos
Index: demos/Zend/Gdata/YouTubeVideoBrowser/index.php
===================================================================
--- demos/Zend/Gdata/YouTubeVideoBrowser/index.php      (revision 7026)
+++ demos/Zend/Gdata/YouTubeVideoBrowser/index.php      (working copy)
@@ -206,7 +206,7 @@
 /*
  * The main controller logic of the YouTube video browser demonstration app.
  */
-$queryType = $_POST['queryType'];
+$queryType = isset($_POST['queryType']) ? $_POST['queryType'] : null;

 if ($queryType === null) {
     /* display the entire interface */

Comments

Hi Bill,

Thanks very much for the report. I fixed and added test cases for the issue in the core library, and fixed the issue with the demo app. Can you please review the code submitted in rev 7030 and 7031?

Thanks! -Ryan

Yep! When I run the unit test with code-coverage reporting, I see that the {{getVideoId()}} method is now tested.