#37 Code style errors

closed-fixed
nobody
None
5
2014-01-18
2012-12-30
Philippe
No

Hello,

Using the PhpStorm code inspector, I ran into the following code style problems/errors which could cause bugs:

File PHPCrawlerLinkFinder.class.php (line 152)
$this->top_lines_processed == true;
should be
$this->top_lines_processed = true;

File PHPCrawlerHTTPRequest.class.php (lines 516, 539, 609 and 625):
$status = socket_get_status($this->socket);
should be
$status = stream_get_meta_data($this->socket);

File PHPCrawlerHTTPRequest.class.php (lines 523, 618)
socket_set_timeout($this->socket, $this->socketReadTimeout);
should be
stream_set_timeout($this->socket, $this->socketReadTimeout);

File PHPCrawlerDocumentInfoQueue.class.php
There is no field 'prepared_insert_statement' declared

I also spotted some "weirdness" in file phpcrawlsetup.class.php around line 174:
if ($this->setup_array_raw[$key]=="0") (bool)$argument=false;
if ($this->setup_array_raw[$key]=="1") (bool)$argument=true;

I'm not usure what you did want to do :P

I think I have finshed :)

Discussion

  • Uwe Hunfeld

    Uwe Hunfeld - 2013-01-02

    Hi!

    Thanks a lot!

    Did phpstorm say something about why to use stream_get_meta_data instead of socket_get_status and stream_set_timeout instead of socket_set_timeout? Seems that these functions are identical and just aliases for eachother, and they are not deprecated as far as i can see. So where's the problem?

    Thenak you for the report!

     
  • Philippe

    Philippe - 2013-01-02

    Hello,

    About the stream_* and socket_* , it's just because as they're considered aliases, their arguments aren't documented -> hence reference errors.
    And stream_* functions can work with more streams then the socket_* socket-based ones (I suppose socket_* were kept because of BC with PHP 4.2 and earlier)

     
  • Uwe Hunfeld

    Uwe Hunfeld - 2014-01-18

    Fixed since version 0.82.

     
  • Uwe Hunfeld

    Uwe Hunfeld - 2014-01-18
    • status: open --> closed-fixed
     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks