Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix undefined offset on strict mode #83

Closed
wants to merge 1 commit into from
Closed

Conversation

mkdgs
Copy link

@mkdgs mkdgs commented Oct 9, 2012

textile code like :
=.=.=
(remove . between =)
=.=.=.=

generate error in strict mode (undefined offset).
use of array_pad to avoid that. (it's maybe also a good idea to apply array_pad on all list() in this class)

textile code like:
===
foo
==== 
generate error in strict mode (undefined offset).
use of array_pad to avoid that. (it maybe also a good idea to apply array_pad on all list() in this class.
@netcarver
Copy link
Contributor

Hello. I'm trying to reproduce this locally in my test setup. Can you show me the arguments you are using to call TextileThis() please?

@mkdgs
Copy link
Author

mkdgs commented Oct 10, 2012

ok ! i know why you can't reproduce that, i used error_handler and this break @ silence opérator.

require_once('classTextile.php');
ini_set('error_reporting', -1);
ini_set('display_errors', 1);
ini_set('html_errors', 1);
function error_( $number, $message, $file, $line )  {
        $error = array( 'type' => $number, 'message' => $message, 'file' => $file, 'line' => $line );
        print_r( $error );
}
set_error_handler('error_');
$txt = '
=== 
foo
==== 
';
$textile = new Textile();
echo $textile->TextileThis($txt);

sorry it's due by my developpement environement, but i think array_pad is a better practice.

@netcarver
Copy link
Contributor

Ok, looking at this right now and removing the @ allows it to manifest clearly. I'll probably pad with '' (empty string) rather than null here.

@netcarver netcarver closed this in 4951e25 Nov 11, 2012
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants