fuel / orm

Fuel PHP Framework - Fuel v1.x ORM
http://fuelphp.com/docs/packages/orm/intro.html
152 stars 96 forks source link

Possible undefined index in Observer_Slug #127

Closed tabacco closed 12 years ago

tabacco commented 12 years ago

In the expression on line 61, the only match is optional, so preg_match() can return 1 and cause execution to enter the if statement even if there's no index trailing the slug.

If this happens, $matches[1] isn't set on line 64, triggering an E_NOTICE.

My cheap fix is to replace line 64 with $index = isset($matches[1]) ? (int)$matches[1] : 0;

billmn commented 12 years ago

I've fixed this with a pull request

dmyers commented 12 years ago

Ran into this too. Hope they merge this. I found this thread first: http://fuelphp.com/forums/topics/view/6408

HellPat commented 12 years ago

With this fix the oberserver works fine!

jschreuder commented 12 years ago

@billmn you didn't actually pull-request did you? The commit is shown here but I can't pull it using Github right now.

billmn commented 12 years ago

I've pulled a request here: https://github.com/fuel/orm/pull/144 Observer_Slug fix was appended into "Fixed label translation in validation messages (Fixed Issue #130)" ... what can I do?

jschreuder commented 12 years ago

I just noticed, for once it's not a problem as both will be accepted.

jschreuder commented 12 years ago

Solved by https://github.com/fuel/orm/pull/144