我目前正在尝试使用Zend Framework 2 Tutorial。
我在 Solaris 系统上使用带有 Zend Engine v2.4.0 的 Apache 2 和 php 5.4.7。
我设法创建了我需要的一切,但是当我想从我的列表中添加或删除专辑时,Apache 子进程总是崩溃并给出分段错误。我用gdb httpd回溯了这个,运行-X直到错误发生,发现最后一次执行某事的帧试图获取Zend的StringLength.php:169的函数isValid()
添加或编辑专辑时,用户必须提供艺术家数据和专辑名称,然后点击提交按钮。现在在验证表单的输入时崩溃了。
我尝试添加单个字符名称,包含名称的 üöä 和简单的名称,如“simon the cat”,一切都失败了。
你有什么建议可能是什么问题?
编辑:
我对错误进行了更多定位。
public function isValid($value)
{
if (!is_string($value)) {
$this->error(self::INVALID);
return false;
}
/*
$this->setValue($value);
if ($this->getEncoding() !== null) {
$length = iconv_strlen($value, $this->getEncoding());
} else {
$length = iconv_strlen($value);
}
if ($length < $this->getMin()) {
$this->error(self::TOO_SHORT);
}
*/
if (null !== $this->getMax() && $this->getMax() < $length) {
$this->error(self::TOO_LONG);
}
if (count($this->getMessages())) {
return false;
} else {
return true;
}
}
分段错误在 isValid() 中的注释之间引发。也许它与 getEncoding() 方法有关?
编辑2:
问题与iconv_strlen有关,但不知道为什么:/如果您只使用普通的strlen(),效果很好