php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61836 SolrDocument cannot be extended due to hashtable issue
Submitted: 2012-04-24 12:50 UTC Modified: -
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: christian dot brown at cbsinteractive dot com Assigned:
Status: Closed Package: solr (PECL)
PHP Version: 5.4.0 OS: CentOS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: christian dot brown at cbsinteractive dot com
New email:
PHP Version: OS:

 

 [2012-04-24 12:50 UTC] christian dot brown at cbsinteractive dot com
Description:
------------
To develop a work around for Bug 59376, where I cannot call ->addField('name', 
false), since false falls back to blank and causes an error to Solr, I've tried to 
extend SolrDocument, but it incurs an error.

Either SolrDocument should be Final or should be extendible without error.


Test script:
---------------
class Model_SolrDocument extends SolrDocument
{
        public function addField($fieldName, $fieldValue)
        {
                if (is_bool($fieldValue))
                        $fieldValue = ($fieldValue ? '1' : '0');
                return parent::addField($fieldName, $fieldValue);
        }
}

$doc = new Model_SolrDocument();
$doc->addField('testname', 'testvalue');



Expected result:
----------------
For the class to be extendible and in this example testname=>testvalue keypair 
added to the SolrDocument; OR for a fatal error saying my class may not inherit 
from final class.


Actual result:
--------------
Warning: SolrDocument::__get(): Invalid Document Index 0. HashTable index does 
not exist. in /path/to/script.php on line 11

Call Stack:
    0.0005     238664   1. {main}() /path/to/script.php:0
    0.0006     239920   2. Model_SolrDocument->addField() /path/to/script.php:18
    0.0006     240008   3. SolrDocument->addField() /path/to/script.php:11

Warning: SolrDocument::__get(): Internal Error 1008 generated from 
/tmp/pear/temp/solr/solr_functions_helpers.c 176 solr_fetch_document_entry. The 
observed error is a possible side-effect of an illegal/unsupported operation in 
userspace. Please check the documentation and try again later. in 
/path/to/script.php on line 11

Call Stack:
    0.0005     238664   1. {main}() /path/to/script.php:0
    0.0006     239920   2. Model_SolrDocument->addField() /path/to/script.php:18
    0.0006     240008   3. SolrDocument->addField() /path/to/script.php:11

Warning: Unknown: Invalid Document Index 0. HashTable index does not exist. in 
Unknown on line 0

Warning: Unknown: Internal Error 1008 generated from 
/tmp/pear/temp/solr/solr_functions_helpers.c 176 solr_fetch_document_entry. The 
observed error is a possible side-effect of an illegal/unsupported operation in 
userspace. Please check the documentation and try again later. in Unknown on 
line 0


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-18 23:41 UTC] omars@php.net
Automatic comment on behalf of omars
Revision: http://git.php.net/?p=pecl/search_engine/solr.git;a=commit;h=2186ec810589e3023507c1a66bfd5cd44570958b
Log: Fixed Bug #61836, reverted read only classes to be final again
 [2014-02-18 23:41 UTC] omars@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 18:01:30 2024 UTC