Issues

ZF-12492: assertHeaderContains

Description

assertHeaderContains and assertNotHeaderContains Fails when match is at the beginning of the string. This is caused the the strstr function returning 0 which is being evaluated to false.

Comments

Fix is simple by just doing a cast to bool:

Zend_Test_PHPUnit_Constraint_ResponseHeader::_headerContains: return (strstr($contents, $match) !== false);

Zend_Test_PHPUnit_Constraint_ResponseHeader::_notHeaderContains: return (strstr($contents, $match) === false);

Corrrection to description, If '0' is used for the string it will be evaluated as false: ex $this->assertHeaderContains('Expires', '0');

Hi Chuck, can you add a patch and an unit test?

Working on it now

Here are the patches for the tests and fix

Thanks! I will check and commit this.

Fixed on trunk (25204) and release-1.12 (25205)

Thanks to Chuck!