473,698 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

preg_replace_ca llback() is segfaulting in 4.4.4, length related?

I'm having a problem where I changed hosts, went from php 4.1.2 to php
4.4.4, and now preg_replace_ca llback() is segfaulting when I pass it html
that is longer than 2732 bytes. This code has worked for a long time on a
different server.

Basically, I am reading an html page template into a variable with fread().

I then am doing this, which is code taken from a user example on the eval()
php manual page, which I have used successfully for quite awhile:

What it does is evaluate mixed html and php code, and output to browser. You
call it like:

eval_mixed($str ing);

function eval_mixed_help er($arr){
return ("echo stripslashes(\" ".addslashes($a rr[1])."\");");
}

function eval_mixed($str ing){

$string = "<? ?>".$string."< ? ?>";
$string = preg_replace("/<\?=\s+(.*?)\s+ \?>/", "<? echo $1; ?>",
$string);
$string = str_replace('?> ', '', str_replace( array('<?php', '<?'),
'', preg_replace_ca llback( "/\?>((.|\n)*?)<\ ?(php)?/", "eval_mixed_hel per",
$string) ) );

return eval($string);
}

If the template that I read into $string is 2732 or less bytes, it works
like it always did. If it is 2733 or greater bytes, it segment faults.

I found this report in the bug database, but it's really old. It sounds like
the same thing, though:

http://bugs.php.net/bug.php?id=25754
Bug*#25754 preg_replace() and preg_replace_ca llback() crash with long
matches

Anybody know anything about this?

Again, it worked fine on the older php on a different server.
I don't really know what to do to proceed with this, it's a bit out of my
league.

Any advice would be greatly appreciated!

--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Jan 2 '07 #1
0 1299

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2635
by: Ian.H | last post by:
Hi all, I'm trying to write a PHP colour parser and after various attempts, something, somewhere trips it over. Some details: String to parse: $origString = '^1foo^5bar';
1
1859
by: Geoffrey Clements | last post by:
I'm brand new to Python - just giving it a try but I'm having trouble with eric3. This query isn't exactly about the Python language but it is related. I run KDE on linux so I already have Qt installed. I have installed Python, SIP, QScintilla, PyQt and eric3. When I run eric3 the fonts in the editor are way too large, so I selected preferences to change them but when I hit "OK" I get a segfault whether I have made a change or not.
3
1803
by: Fernando Perez | last post by:
Hi all, I am seeking advice/help from those with more win32 experience than myself. I am trying to build a proper win32 installer for IPython, after a user did most of the hard work. For the most part, it's working very well, but I am running into a nasty problem, which took me a few hours to finally understand. This smells to me like a python bug, but I could be wrong. Much googling didn't turn up anything relevant. Here is a...
1
1695
by: Simen Brekken | last post by:
Hi, I'm currently running 7.3.4 on Debian/testing, I've been trying to get pgxml_dom working but after doing some normal tests I find that it segfaults the postmaster whenever it hits an error, is this because the contrib module isn't maintained beyond alpha stage or doesn't it simply handle anything but completely well-formed documents without entities etc? Are there any alternatives to this module? I was thinking of using this for...
8
4473
by: jody.florian | last post by:
Hi, I'm trying to use preg_replace_callback within a method. The preg_replace_callback() & mycallback() pair will only be used by this method, and this method will probably only be called once in the object's lifetime (so there's no sense in making the callback function a method of the class...(is there??)) Instead, I wanted to use create_function() to create a make-shift callback function within the method. (seeing as you can't...
14
3980
by: mens libertina | last post by:
Disclaimer: In addition to reading the skimpy entries at php.net, I've searched this group and alt.php to no avail. Basically, I'm trying to use a template to send email reminders, but I can't use my backreferences the way I would like. (template.inc is not installed on my host.) If I'm approaching the problem wrong, please have mercy and tell me how to solve it! :) I have an array, $info, that looks like this (this is just one user):...
2
13262
by: Kimmo Laine | last post by:
I tried to use a class member function as a callback in preg_replace_callback, but failed. It announces: " Warning: preg_replace_callback() : requires argument 2, 'myclass::myfunction', to be a valid callback in ..." I tried both myclass::myfunction and $this->myfunction, neither worked. Is there really no way of using a class member as a callback, it has to be an external function? That sucks... :(
2
3570
by: Snaggy | last post by:
this is my problem: Class myClass { function process($matches) {return something($matches);} function myReplace($input) { return preg_replace_callback(/pattern/, '$this->process', $input) }
4
1795
by: Jeff | last post by:
I've been struggling with this for a while. Here's what I'm trying to do: private function makeMiniTemplate($ARRAY){ /* $ARRAY looks like this: $ARRAY='Some Value';
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.