Download & Extend

Confusion over when to use PHP 4 and PHP 5

Project:Technorati
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

It looks like the technorati 6.x version of this module is written in php 5 while older technorati modules are written to support php 4. Now my install of Drupal 6.4 is run on a php 4 site, but the technorati module seems only built for php 5.

a) how about documenting which version of php is supported in the release notes or install notes.
b) how about offering a php 4 version of the technorati module
c) as a quick work-around I simply commented out this line from the technorati 6.x version of this module's technorati.info file to get the module to install in my Drupal 6.4 site [not yet sure if this is a workable solution]:
technorati 6.x version of this module.

Link to my site's blog with respect to item c) above:
http://www.ronfredericks.net/drupal-6.4/?q=node/7

Best regards,

Ron Fredericks

Comments

#1

Status:active» closed (won't fix)

In general, it is a bad idea to use PHP 4 nowadays.

PHP 4 is dead. It is unsupported and you should move to PHP 5 as soon as possible.

See http://gophp5.org/

If removing the "php = 5.1" line from the .info file works for you, then well and good. Otherwise you really should upgrade.

I am asking the patch creator why he did that here http://drupal.org/node/276874#comment-1019646 in case it as added by mistake.

#2

@ronf

Check my question here and the reply to it http://drupal.org/node/276874#comment-1019646

I strongly recommend that you upgrade to 5.2.x, but if you extensively test the module under 4.4 and find that EVERYTHING runs fine, I can remove that restriction.

#3

I appreciate your willingness to look into what happened here. It doesn't really matter what I think of php 5 vs. 4. But to me the IDE from where I do the coding makes the big difference: PHPEclipse vs. Dreamweaver - for example.

I suspect that your module will work fine by simply removing that PHP line from the .info. I see no errors and the code itself seems very tame considering what a true OO php 5 module might really demand from a first pass by a casual code inspection. I have already contributed useful code to this module back about a year ago for Drupal 5 and this module's code for Drupal 6 seems nearly the same as I remember from back then. A word of thanks to you personally back then, as you held my hand as a Drupal nubee developing my first patch for this open source community - a true value to my own technical development: http://drupal.org/node/101047

So the good news is: I don't mind extensively testing your module on my PHP 4 site. While the bad news is that I have not been able to get the ping module to work on any Drupal release: version 5 or 6; still a nubee I'm afraid. If I ever get Drupal to actual support ping, probably my lack of knowledge around .htaccess, then I will get back to you on how well the technorati module works on Drupal 6 and PHP 4.

Best regards,

Ron Fredericks

#4

@ronf

Regarding ping, some hosts are setup up in a way to disallow a PHP program from connecting to external sites.

Check if your host restricts fopen/fwrite to remote hosts.

You can write a test script/module to call http://api.drupal.org/api/function/drupal_http_request and see if it errors out.

#5

I'm making progress...

My host allows me to make fopen/fwrite calls to remote hosts. I use these calls extensively in my webscan PHP link checking package with no error.

I think your drupal_http_request link will be very useful - thanks.

During my initial testing of ping, I discovered what appears to be a simple coding error in technorati.module ping function. The error is in the the watchdog function calls - note the missing "array()" parameter. Here is the code snippet within the technorati for Drupal version 6 module with two updated watchdog() functions added:

<?php

// Code snippet from technorati.module beta for drupal 6.4
function technorati_ping($name = '', $url = '') {
 
$result = xmlrpc('http://rpc.technorati.com/rpc/ping', 'weblogUpdates.ping', $name, $url);
  if (
$result) {
   
// removed RDF 9/23/08 -> watchdog("directory ping", 'Successfully notified technorati.com site.', WATCHDOG_NOTICE);
   
watchdog('directory ping', 'Successfully notified technorati.com site.', array(), WATCHDOG_NOTICE);

  }
  else {
   
// removed RDF 9/23/08 -> watchdog('directory ping', 'Failed to notify technorati.com site.', WATCHDOG_WARNING);
   
watchdog('directory ping', 'Failed to notify technorati.com site.', array(), WATCHDOG_WARNING);
  }
}
?>

This code change eliminated these two recurring errors as found in my Admin-> Report-> Recent log entries

warning: Invalid argument supplied for foreach() in /drupal-6.4/includes/common.inc on line 789.

warning: strtr() [function.strtr]: The second argument is not an array in /drupal-6.4/includes/common.inc on line 806.

Best regards,

Ron Fredericks

#6

You should have included this in a separate issues since it has nothing to do with PHP4/5 and is a new topic.

But anyway, I incorporated the change in the -dev version.

#7

Thanks for managing this poorly placed code snippet Khalid.

For the casual reader, my error report in no way confirms or denies my current review of technorati module efficacy on Drupal 6 running on PHP 4 server. That part of my effort still continues...

Ron

nobody click here