GedzyukAnatolyu / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Undefined index: dataType in phpQuery/phpQuery.php on line 815 #194

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

    <?php
    require_once('lib/phpQuery/phpQuery.php');
    $url = 'http://www.bing.com/';
    phpQuery::browserGet($url, 'success1');
    function success1($browser) { $browser->WebBrowser('success2')->find('form')->submit(); }
    function success2($browser) { return true; }
    ?>

What is the expected output? What do you see instead?

Expected: no notices.

Instead:

    PHP Notice:  Undefined index: dataType in phpQuery/phpQuery.php on line 815
    PHP Notice:  Undefined index: dataType in phpQuery/phpQuery.php on line 815

The notice pops up during the processing of success1().

What version of the product are you using? On what operating system?

phpQuery 0.9.5 (r386; full package) on Mac OS X with PHP 5.3.6, have not tested 
on other systems.

Please provide any additional information below.

The issue arises in this line:

    $data = self::httpData($response->getBody(), $options['dataType'], $options);

The obvious solution would be this:

    $data = self::httpData($response->getBody(), isset($options['dataType'])?$options['dataType']:'', $options);

I have made this change in my current application successfully. When I look 
over the phpQuery code I see that $options['dataType'] is practically always 
checked with isset, except in this one case. So I assume that it is expected to 
be missing in many cases.

Original issue reported on code.google.com by liep...@gmail.com on 20 Sep 2011 at 11:05