php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64278 Segmentation fault thrown on "?" operator
Submitted: 2013-02-22 15:02 UTC Modified: 2013-07-18 03:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gabrielwu84 at gmail dot com Assigned: gabrielwu84 (profile)
Status: Closed Package: operator (PECL)
PHP Version: 5.4.12 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 17 = ?
Subscribe to this entry?

 
 [2013-02-22 15:02 UTC] gabrielwu84 at gmail dot com
Description:
------------
<?php
$a = 1 ? 1 : date();
exit;
?>

That script gives me a Segmentation Fault under PHP 5.4.11 when the operator 
package is loaded.

Test script:
---------------
<?php
$a = 1 ? 1 : date();
exit;
?>



Patches

fix-0.4.1-PHP_OPERATOR_OPHANDLER_COUNT (last revision 2013-02-25 03:58 UTC by ku at digitaldolphins dot jp)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-25 03:57 UTC] ku at digitaldolphins dot jp
PHP_OPERATOR_OPHANDLER_COUNT doesn't match with recent PHP 5's one.

operator.c in operator-0.4.1:
---
#define PHP_OPERATOR_OPHANDLER_COUNT ((25 * 151) + 1)
---

PHP 5.4 has more. It'll need conditional check like following:
---
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 5)
# error "Operator overload support requires newer PHP_OPERATOR_OPHANDLER_COUNT"
#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 5)
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 164) + 1)
#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 4)
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 159) + 1)
#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3)
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 154) + 1)
#else
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 151) + 1)
#endif
---

I'll attach a patch for this problem.

Thanks
 [2013-02-25 14:51 UTC] ryan dot brothers at gmail dot com
Thanks for the help.  That resolves the issue for me.
 [2013-03-26 23:34 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: gabrielwu84
 [2013-05-06 02:12 UTC] ryan dot brothers at gmail dot com
I encountered another segmentation fault.  I just entered https://bugs.php.net/bug.php?id=64777.
 [2013-07-18 02:53 UTC] pollita@php.net
-Status: Assigned +Status: Closed
 [2013-07-18 02:53 UTC] pollita@php.net
This got fixed with my version fixes last february.
 [2013-07-18 03:00 UTC] gabrielwu84@php.net
Bug fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 22:01:28 2024 UTC