When previewing stories today, we started seeing the following errors:
panic: sv_setpvn called with negative strlen at
/usr/local/bricolage/lib/Bric/Util/Burner/Mason.pm line 590
panic: sv_setpvn called with negative strlen at
/usr/local/bricolage/lib/Bric/Util/Burner/Mason.pm line 594
I finally determined that a single story was causing the problem.
Basically, when this story is previewed, it causes the above error and
then most previews for other stories afterward cause the same error.
However, when I restart Bricolage, the problem went away until I
previewed the problem story again.
This story outputs a PHP file and this line of code seems to be the
cause:
$uri = urlencode(preg_replace('/&?(x|y)=\d*/', '',
$_SERVER['REQUEST_URI']));
I changed the code to the following and the error went away:
$uri = preg_replace('/&?(x)=\d*/', '', $_SERVER['REQUEST_URI']);
$uri = urlencode(preg_replace('/&?(y)=\d*/', '', $uri));
Here's the relevant code from Mason.pm (1.10.3):
sub end_page {
my $self = shift;
my ($page, $buf) = $self->_get(qw(page _buf));
my $file = $self->page_filepath(++$page);
my $uri = $self->page_uri($page);
# Save the page we've created so far.
open(OUT, ">$file") // *** line 590 ***
or throw_gen error => "Unable to open '$file' for writing",
payload => $!;
binmode(OUT, ':' . $self->get_encoding || 'utf8') if ENCODE_OK;
print OUT $$buf; // *** line 594 ***
close(OUT);
# Add a resource to the job object.
$self->add_resource($file, $uri);
# Clear the output buffer.
$$buf = '';
# Increment the page number
$self->_set(['page'], [$page]);
}
It seems odd that story content would cause this sort of problem.
Chris
--------------------------------
Chris Schults
Web Developer
PCC Natural Markets
206-547-1222 x104
chris.schults@pccsea.com
http://www.pccnaturalmarkets.com
Sign up for PCC Fresh, a monthly newsletter filled with seasonal
recipes, exciting new products, and more:
http://www.pccnaturalmarkets.com/enews
panic: sv_setpvn called with negative strlen at
/usr/local/bricolage/lib/Bric/Util/Burner/Mason.pm line 590
panic: sv_setpvn called with negative strlen at
/usr/local/bricolage/lib/Bric/Util/Burner/Mason.pm line 594
I finally determined that a single story was causing the problem.
Basically, when this story is previewed, it causes the above error and
then most previews for other stories afterward cause the same error.
However, when I restart Bricolage, the problem went away until I
previewed the problem story again.
This story outputs a PHP file and this line of code seems to be the
cause:
$uri = urlencode(preg_replace('/&?(x|y)=\d*/', '',
$_SERVER['REQUEST_URI']));
I changed the code to the following and the error went away:
$uri = preg_replace('/&?(x)=\d*/', '', $_SERVER['REQUEST_URI']);
$uri = urlencode(preg_replace('/&?(y)=\d*/', '', $uri));
Here's the relevant code from Mason.pm (1.10.3):
sub end_page {
my $self = shift;
my ($page, $buf) = $self->_get(qw(page _buf));
my $file = $self->page_filepath(++$page);
my $uri = $self->page_uri($page);
# Save the page we've created so far.
open(OUT, ">$file") // *** line 590 ***
or throw_gen error => "Unable to open '$file' for writing",
payload => $!;
binmode(OUT, ':' . $self->get_encoding || 'utf8') if ENCODE_OK;
print OUT $$buf; // *** line 594 ***
close(OUT);
# Add a resource to the job object.
$self->add_resource($file, $uri);
# Clear the output buffer.
$$buf = '';
# Increment the page number
$self->_set(['page'], [$page]);
}
It seems odd that story content would cause this sort of problem.
Chris
--------------------------------
Chris Schults
Web Developer
PCC Natural Markets
206-547-1222 x104
chris.schults@pccsea.com
http://www.pccnaturalmarkets.com
Sign up for PCC Fresh, a monthly newsletter filled with seasonal
recipes, exciting new products, and more:
http://www.pccnaturalmarkets.com/enews