segfault error when using last version #12

Closed
ikwattro opened this Issue Mar 7, 2012 · 5 comments

Projects

None yet

2 participants

ikwattro commented Mar 7, 2012

Hi chobie,

If I use the last version of the PECL Sundown, I get always segfault error in my logs and an empty_response from the app

[Sun Mar 04 13:47:37 2012] [notice] child pid 30341 exit signal Segmentation fault (11)
[Sun Mar 04 13:48:43 2012] [notice] child pid 11304 exit signal Segmentation fault (11)
[Sun Mar 04 13:48:56 2012] [notice] child pid 30343 exit signal Segmentation fault (11)
[Sun Mar 04 13:48:57 2012] [notice] child pid 11302 exit signal Segmentation fault (11)

I've downgraded to the sundown-0.2.0 for the moment.

I have to say when I show my page the first time it works, then get the error if I refresh or use a page that use the extension. Looks like he do not accept to use another instance.

Owner
chobie commented Mar 7, 2012

oops, sorry. let me look into it.

ikwattro commented Mar 7, 2012

no problem, btw do you intend to add some extra renderers. like the possibilty to have markdown into html like the following :

<div style="text-align:center;"> # Level 1 title </div>

Or with your own syntax

center# Level 1 title
Owner
chobie commented Mar 9, 2012

Sorry for rain response. Probably I've fixed the issue. could you check with latest master branch?
chobie/php-sundown@683b1d3

No I don't. But you can define custom render like this.

<?php

class YourRender extends \Sundown\Render\HTML
{
        public function paragraph($text)
        {
                return sprintf('<div class="text-align:center">%s</div>',$text);
        }
}


$md = new Sundown\Markdown(new YourRender());
echo $md->render("
lorem ipsum
");
// this will output
// <div class="text-align:center">lorem ipsum</div>

or use preprocess

<?php

class YourRender extends \Sundown\Render\HTML
{
        public function preProcess($text)
        {
                return preg_replace("/^center# (.+)/m","<div style=\"text-align:center;\">$1</div>",$text);
        }
}


$md = new Sundown\Markdown(new YourRender());
echo $md->render("
echo $md->render("
center# Level 1 Hello
# header text");

// this will output
// <div style="text-align:center;">Level 1 Hello</div>
// <h1>header text</h1>

Sundown does not provide any custom parser AFAIK. In this case, you should use preProcess or some custom render method.

ikwattro commented Mar 9, 2012

I will try it.

Yes sundown does not provide such renderers. But I would prefer to avoid php parsing with regex's.

closed for a time but forgot to do it.

@ikwattro ikwattro closed this Apr 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment