phpprintipp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpprintipp] Re: _interpretInteger failing?


From: Brian Kroth
Subject: [Phpprintipp] Re: _interpretInteger failing?
Date: Mon, 16 Aug 2010 16:57:30 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

And here's another patch to fix that issue.

Brian Kroth <address@hidden> 2010-08-16 07:14:
> Some more info on that situation:
> 
> $ipp->setPrinterURI('/printers/');
> $ipp->getJobs($my_jobs=true, $limit=0, $which_jobs='', $subset=false);
> foreach ($ipp->jobs_attributes as $job) {
>       print_r($job);
> }
> 
> However, if I do the following, all the details seem to be returned:
> 
> $ipp->setPrinterURI('/printers/');
> $ipp->getJobs($my_jobs=true, $limit=0, $which_jobs='', $subset=false);
> foreach ($ipp->jobs_attributes as $job) {
>       $ipp->getJobAttributes($job->job_uri->_value0, false, 'all');
>       $job = $ipp->job_attributes;
>       print_r($job);
> }
> 
> Thanks,
> Brian
> 
> Brian Kroth <address@hidden> 2010-08-13 16:51:
> > Hello, I was just looking at the CVS version of your PHP classes and it
> > appears that the _interpretInteger() function is always returning 0.
> > Any thoughts?
> > 
> > For example:
> >     [time_at_creation] => stdClass Object
> >         (
> >             [_type] => integer
> >             [_range] => job-attributes
> >             [_value0] => 0
> >         )
> > 
> >     [time_at_processing] => stdClass Object
> >         (
> >             [_type] => no-value
> >             [_range] => job-attributes
> >             [_value0] => 
> >         )
> > 
> >     [time_at_completed] => stdClass Object
> >         (
> >             [_type] => no-value
> >             [_range] => job-attributes
> >             [_value0] => 
> >         )
> > 
> >     [job_id] => stdClass Object
> >         (
> >             [_type] => integer
> >             [_range] => job-attributes
> >             [_value0] => 0
> >         )
> > 
> >     [job_state] => stdClass Object
> >         (
> >             [_type] => enum
> >             [_range] => job-attributes
> >             [_value0] => Unknown(IETF standards track "job-state" 
> > reserved): 0x64d9d3d5
> >         )
> > 
> >     [job_media_sheets_completed] => stdClass Object
> >         (
> >             [_type] => integer
> >             [_range] => job-attributes
> >             [_value0] => 0
> >         )
> > 
> > Also, split() was deprecated in php 5.3.0, so I replaced all calls to
> > that with preg_split() in my local copy.  I've attached a patch for
> > that.  It seems you've already solved the socket reading problem that
> > were preventing more than some small number of printers from being
> > listed.
> > 
> > Thanks,
> > Brian
> 
> > ? preg_split.diff
> > Index: BasicIPP.php
> > ===================================================================
> > RCS file: /sources/phpprintipp/phpprintipp/php_classes/BasicIPP.php,v
> > retrieving revision 1.5
> > diff -u -r1.5 BasicIPP.php
> > --- BasicIPP.php    9 Oct 2009 17:05:12 -0000       1.5
> > +++ BasicIPP.php    13 Aug 2010 21:49:25 -0000
> > @@ -545,7 +545,8 @@
> >    if (!$page_ranges) return true;
> >    $page_ranges = trim(str_replace("-", ":", $page_ranges));
> >    $first = true;
> > -  $page_ranges = split(' ', $page_ranges);
> > +  #$page_ranges = split(' ', $page_ranges);
> > +  $page_ranges = preg_split('# #', $page_ranges);
> >    foreach($page_ranges as $page_range) 
> >    {
> >     $value = self::_rangeOfIntegerBuild($page_range);
> > @@ -1222,7 +1223,8 @@
> >  
> >     default:
> >     $server_response = preg_replace("/: $/", '', 
> > $this->serveroutput->headers[0]);
> > -   $strings = split(' ', $server_response, 3);
> > +   #$strings = split(' ', $server_response, 3);
> > +   $strings = preg_split('# #', $server_response, 3);
> >     $errno = $strings[1];
> >     $string = strtoupper(str_replace(' ', '_', $strings[2]));
> >     trigger_error(
> > @@ -1847,7 +1849,8 @@
> >  
> >   protected function _rangeOfIntegerBuild($integers) 
> >   {
> > -  $integers = split(":", $integers);
> > +  #$integers = split(":", $integers);
> > +  $integers = preg_split("#:#", $integers);
> >    for ($i = 0; $i < 2; $i++) $outvalue[$i] = 
> > self::_integerBuild($integers[$i]);
> >    return $outvalue[0] . $outvalue[1];
> >   }
> > Index: http_class.php
> > ===================================================================
> > RCS file: /sources/phpprintipp/phpprintipp/php_classes/http_class.php,v
> > retrieving revision 1.6
> > diff -u -r1.6 http_class.php
> > --- http_class.php  1 Mar 2010 19:17:36 -0000       1.6
> > +++ http_class.php  13 Aug 2010 21:49:25 -0000
> > @@ -175,7 +175,8 @@
> >    $this->connected = false;
> >    $url = $arguments["URL"];
> >    $port = $this->default_port;
> > -  $url = split (':', $url, 2);
> > +  #$url = split (':', $url, 2);
> > +  $url = preg_split ('#:#', $url, 2);
> >    $transport_type = $url[0];
> >    $unix = false;
> >    switch ($transport_type)
> > @@ -201,7 +202,8 @@
> >    $url = $url[1];
> >    if (!$unix)
> >    {
> > -   $url = split ("/", preg_replace ("#^/{1,}#", '', $url), 2);
> > +   #$url = split ("/", preg_replace ("#^/{1,}#", '', $url), 2);
> > +   $url = preg_split ("#/#", preg_replace ("#^/{1,}#", '', $url), 2);
> >     $url = $url[0];
> >     $port = $this->port;
> >     $error = sprintf (_("Cannot resolve url: %s"), $url);
> > @@ -247,7 +249,8 @@
> >    {
> >     return $this->_HttpError ($error, E_USER_WARNING);
> >    }
> > -  $authtype = split (' ', $this->reply_headers["www-authenticate"]);
> > +  #$authtype = split (' ', $this->reply_headers["www-authenticate"]);
> > +  $authtype = preg_split ('# #', $this->reply_headers["www-authenticate"]);
> >    $authtype = strtolower ($authtype[0]);
> >    switch ($authtype)
> >    {
> > @@ -516,11 +519,14 @@
> >   private function _BuildDigest ()
> >   {
> >    $auth = $this->reply_headers["www-authenticate"];
> > -  list ($head, $auth) = split (" ", $auth, 2);
> > -  $auth = split (", ", $auth);
> > +  #list ($head, $auth) = split (" ", $auth, 2);
> > +  list ($head, $auth) = preg_split ("# #", $auth, 2);
> > +  #$auth = split (", ", $auth);
> > +  $auth = preg_split ("#, #", $auth);
> >    foreach ($auth as $sheme)
> >    {
> > -   list ($sheme, $value) = split ('=', $sheme);
> > +   #list ($sheme, $value) = split ('=', $sheme);
> > +   list ($sheme, $value) = preg_split ('#=#', $sheme);
> >     $fields[$sheme] = trim (trim ($value), '"');
> >    }
> >    $nc = sprintf ('%x', $this->nc);
> > @@ -559,7 +565,8 @@
> >    if (array_key_exists ("qop", $fields))
> >    {
> >     $qop = strtolower ($fields["qop"]);
> > -   $qop = split (" ", $qop);
> > +   #$qop = split (" ", $qop);
> > +   $qop = preg_split ("# #", $qop);
> >     if (in_array ("auth", $qop))
> >      $qop = "auth";
> >     else
> 
> 
> 


Attachment: interdiff.diff
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]