php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31626 calling ereg_replace before pspell_new crashes pspell
Submitted: 2005-01-20 17:25 UTC Modified: 2005-03-08 01:00 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: bram dot dejong at gmail dot com Assigned:
Status: No Feedback Package: Pspell related
PHP Version: 5.0.3 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bram dot dejong at gmail dot com
New email:
PHP Version: OS:

 

 [2005-01-20 17:25 UTC] bram dot dejong at gmail dot com
Description:
------------
Calling ereg_replace before pspell_new crashes pspell.

pspell_new *only* fails when calling ereg_replace before it (i.e. I haven't witnessed any other crashes yet...)

Pspell is installed following this guide (and all is working):
http://www.oblius.com/?.blogs.184

Changes in php.ini file:
extension=php_pspell.dll

Reproduce code:
---------------
<?
  $string1 = "heeelp";
  $string2 = ereg_replace("squeek","squaak",$string1);
  $pspell_link = pspell_new("en", "", "", "", PSPELL_FAST);
  print_r(pspell_suggest($$pspell_link, $string1)
?>

Expected result:
----------------
when I comment this line:
// $string2 = ereg_replace("squeek","squaak",$string1);

the result is:

Array
(
    [0] => help
    [1] => Heep
    [2] => heel
    [3] => heeler
    [4] => heeled
    [5] => heels
    [6] => whelp
    [7] => helps
    [8] => helper
    [9] => harelip
    [10] => hep
    [11] => Helen
    [12] => hello
    [13] => heel's
)

Actual result:
--------------
Warning:  pspell_new() [function.pspell-new]: PSPELL couldn't open the dictionary. reason: No word lists can be found for the language "en".  in c:\Apache\htdocs\Work\bug.php on line 5


Warning:  pspell_suggest() [function.pspell-suggest]: 0 is not a PSPELL result index in c:\Apache\htdocs\Work\bug.php on line 6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-21 00:02 UTC] tony2001@php.net
Pay attention to double "$" here:
print_r(pspell_suggest($$pspell_link, $string1));
And try again.
 [2005-01-24 11:55 UTC] bram dot dejong at gmail dot com
Hi tony,

no idea how those two syntax errors got there, however, the bug is still there:

This works (same output as before):

<pre>
<?
  $pspell_link = pspell_new("en");
	
  $string = ereg_replace("squeek","squaak","squobble");
		
  $pspell_result = pspell_suggest($pspell_link, "help");
		
  print_r($pspell_result);
?>
</pre>

This doesn't:

<pre>
<?
  $string = ereg_replace("squeek","squaak","squobble");
	
  $pspell_link = pspell_new("en");
		
  $pspell_result = pspell_suggest($pspell_link, "help");
		
  print_r($pspell_result);
?>
</pre>

For the most basic version:

  $string = ereg_replace("squeek","squaak","squobble");
  $pspell_link = pspell_new("en");

DOESN'T work, while

  $pspell_link = pspell_new("en");
  $string = ereg_replace("squeek","squaak","squobble");

DOES work.

For the exact error messages, see my first post.

I tried exactly the same on another installation of PHP/pspell (5.0.3 as well) I have on a different computer and there it DOESN'T crash. If there are any additional tests I can run, let me know.
 [2005-02-28 20:59 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC