zendframework / zend-http

Http component from Zend Framework
BSD 3-Clause "New" or "Revised" License
134 stars 85 forks source link

Throw exception when header is invalid #187

Closed michalbundyra closed 5 years ago

michalbundyra commented 5 years ago

Fixes #180 - infinite recursion

roypalacios commented 5 years ago

Hi @webimpress,

It looks good to me. I'll only add few comments:

            // Generic Header should throw an exception if it fails
            if ($isGeneric) {
                throw $exception;
            }

            // Retry one more time with GenericHeader
            return $this->lazyLoadHeader($index, true);

Also, there is a minor optimization we can make at the beginning of the file:

If Generic is true, there is no need parse the key and call the ClassLoader.

I have an enhancement in 2.11.0, so if there's anything I can do to get there, please ask :)

michalbundyra commented 5 years ago

@roypalacios

Thanks for suggestions. I should be working on zend-http 'soon'. As you can see there is a lot of PR I've created recently and more is incoming. I just need to find a time to describe and merge all of them to issue new release. Thanks for your patience.