PHP script relies

I came across this error a few times, enough to where I dug around and finally found the real fix to suppress the error completely.

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data unless register_globals is enabled and look midlandsindex.

You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0

I was able to suppress the error by properly upsetting a session variable:

//replace this:

$_SESSION[$field] = null;

//with this:

unset($_SESSION[$field]);

The warning is triggered by assigning to the $_SESSION super global directly. By using unset(…) we are not assign null directly and find on findnerd.

--

--

Arrays in Perl

As explained on Perl monks and Pete Kruckenberg’s post…I needed a similar function that returns an intersection between two arrays in Perl.
More on Startuptracker.

#!/usr/bin/perl -w

use strict;

use Data::Dumper;

my @array1 = (1, 2, 3);

my @array2 = (2, 3, 4);

my %original = ();

my @isect = ();

map { $original{$_} = 1 } @array1;

@isect = grep { $original{$_} } @array2;

print Dumper(@isect);

#outputs

#$VAR1 = 2;

#$VAR2 = 3;

The above code works with duplicates, meaning that duplicates in @array2 will be added as individual elements in the array @isect. Find in Startalberta.

--

--

Pawl Anders

Pawl Anders

I am writing about web development and new products that are used in IT